dataesr/scientific-paragraphs-categorization huggingface dataset:
The number of intermediate computation steps in the chosen integration method, additional temporary variables introduced by Brian's code generation process, but also the CUDA compute capability of the GPU and even seemingly irrelevant details such as the order of variable declarations, all affect register usage. This demonstrates that minor differences in a model can have large effects on performance. Note that for Brian2GeNN, which performs about 5x slower for the largest network size, we again show the performance of its pre parallelization mode, for which the performance is better at larger network sizes. For smaller network sizes, Brian2GeNN in post parallelization mode performs slightly better (see Supplementary Figure  S1E ). All results in Figure  5  are from simulations with single-precision floats and with preferences that gave the best performance.
The compilation time for Brian's C++ backends Brian2GeNN and Brian2CUDA is mostly comparable, but can differ for some models. Brian's C++ backends and Brian2CUDA generate separate (CUDA C++) source files for each neuronal population object or synapse object. This can increase compilation times for networks with many objects, in particular for Brian2CUDA, which suffers from slower CUDA code compilation. The mushroom body benchmark for example requires almost twice the time for compilation as the STDP benchmark shown here because it consists of twice as many neuronal populations and synapse groups. While Brian2GeNN requires additional time for first generating GeNN code from the Brian model, it can compile the final CUDA code faster because it merges multiple computations into fewer CUDA kernels and source files.
We are currently working on two features that are promising to increase performance for smaller networks: (1) Using CUDA's concurrent kernel execution capabilities, kernels for separate neuron and synapse objects can be executed in parallel while keeping Brian's modular approach. (2) Convenience functions in Brian's Python interface can be implemented that allow users to easily merge multiple versions of the same (potentially small) model into a single large model. This would not only allow much easier parameter explorations of networks on a single GPU but also benefit from Brian2CUDA's optimizations for large networks. Brian2CUDA's main focus is on optimizing the simulation phase, since this typically dominates the overall time for larger networks. To run smaller networks or simpler simulations, however, the long code generation and compilation phase in the beginning (cf.
4). In future versions, we plan a recorder implementation that allows transferring data in regular intervals from GPU to CPU memory, and we will focus on optimizing further unnecessary redundancies and memory inefficiencies. This should close the gap to Brian2GeNN, which is currently more memory-efficient. Brian2CUDA is designed to support all features of Brian2 that are currently supported by its C++ backend and builds on the same code generation framework. It is therefore considerably less limited than the Brian2GeNN backend (discussed below), and supports a large variety of models. We have focused the development on spiking networks of single-compartment models, since they are most likely to benefit from GPU acceleration. Nevertheless, Brian2CUDA has support for other types of models supported by Brian, such as multi-compartment models, or rate-based models.
To give a few recent examples: the Spike simulator  (Ahmad et al. , 2018)  has been optimized for speed, but is implemented as a C++ library and therefore not easily useable for many researchers; the EDEN simulator  (Panagiotou et al. , 2021)  runs arbitrary NeuroML v2 models  (Cannon et al. , 2014) , which means it inherits NeuroML's focus on multi-compartmental models but also its limitations with regard to networks of spiking neurons; the NeuronGPU simulator  (Golosio et al. , 2021)  comes with a convenient Python interface, but implementing new models requires editing the C++ source code of the simulator. The Brian2CUDA interface and its general approach is comparable to the ANNarchy simulator  (Vitay et al. , 2015)  and the GeNN simulator  (Yavuz et al. , 2016)  when used together with its PyGeNN interface  (Knight and Nowotny, 2021).
By being a fully-featured backend for the Brian simulator, however, Brian2CUDA provides additional benefits for researchers that other simulators lack, such as a system of physical units, support for multi-compartmental models, and the possibility to precisely customize execution schedules. As we have shown in this article, Brian2CUDA not only provides flexibility and convenience, but also shows competitive performance for a wide range of network models. The most similar approach to the Brian2CUDA package presented here is obviously the Brian2GeNN package, which is also implemented as a backend for the Brian simulator. Instead of generating CUDA code directly, the Brian2GeNN backend generates code for the GeNN simulator, which then in turn generates CUDA code. This approach has its advantagese.
FUNDING This work was supported by the  Deutsche Forschungsgemeinschaft (DFG)  in the framework of collaborative research centers  SFB910  and  SFB1315  (project number  327654276 ), the  Open Access Publication Fund of TU Berlin  and by  Programme Investissements d'Avenir IHU FOReSIGHT  ( ANR-18-IAHU-01 ).
DATA AVAILABILITY STATEMENT Publicly available datasets were analyzed in this study. The Brian2CUDA software package is publicly available on GitHub: https://github. com/brian-team/brian2cuda. The software version to reproduce the simulations in this study can be found at https://github. com/brian-team/brian2cuda/tree/paper2022 and instructions on how to run them can be found at https:// github. com/brian-team/brian2cuda/tree/paper2022/brian2cuda/ tools/benchmarking.
BACKGROUND Robotic software is typically developed using dedicated component-based frameworks  (Kortenkamp and Simmons, 2008). Each framework is coupled with a middleware  (Elkady and Sobh, 2012) , in charge of low-level primitives of e. g. communicating with the OS. Though ROS  (Quigley et al. , 2009) , the most popular robotic framework today (using its own middleware, called ROS-Com) is unsuitable for real-time robots 4  , a number of frameworks provide "real-time support" such as OROCOS  (Bruyninckx, 2001) , MAUVE  (Gobillot et al. , 2019)  and GenoM3  (Mallet et al. , 2010). Such support is provided through middleware where, contrary to ROS-Com, some real-time aspects are considered and analyzed: the OROCOS-RTT middleware  (Soetens and Bruyninckx, 2005)  for both MAUVE and OROCOS and the PocoLibs 5  middleware for GenoM3 6.
Case Study To validate our approach, we use the Quadcopter case study from LAAS-CNRS. Fig. 1  (right) shows its GenoM3 organization in which some names are modified for simplicity. The system contains five components collaborating to achieve autonomous aerial navigation. We give a high-level description (in terms of components and ports) on how these components collaborate (the interested reader may refer to  Foughali (2017)  for more details on each component). Component MIKROKOPTER processes data from the Inertial Measurement Unit (IMU) and the propellers.
EVALUATION We perform two different types of experiments to evaluate LLAB and R/W LLAB among the other multi-resource locks. The first type evaluates any internal overheads in the uncontended case (Sect. 8. 1), where we use two hardware platforms: an ARM system with four cores (Raspberry Pi 2B running an RTOS) and an Intel system with 2x 16 cores / 64 hardware threads (2x Intel Xeon Silver 4216 running Linux). The ARM system is representative for real-time robots, where MECs feature a low number of cores (Sect. 6. 2), whereas the Intel system allows an evaluation in a more generic multi-core setting. The second type of experiment measures the overheads of an execution scenario with mixed reader-writer workloads using randomized critical sections on the ARM platform (Sect. 8. 2). In each experiment, we compare the presented locking mechanism LLAB resp.
R/W LLAB with other multi-resource locks, namely: DGL  (Ward and Anderson, 2013) , R/W DGL (our task-fair reader-writer variant of DGL), R/W RNLP  (Ward and Anderson, 2014) , MRLock  (Zhang et al. , 2013) , and a multi-bit test and test-and-set (TATAS) lock. The implementation of DGL uses a single queue and is obtained from  Nemitz et al. (2019a). A fast-path optimization allows non-conflicting requests to bypass the queue 11. R/W DGL is our own task-fair reader-writer extension of DGL. It is based on a single queue as well and uses the conflict check described in Sect. 7. 1. But due to the nature of reader-writer locks, it cannot use the fast-path to bypass the queue 12. Our implementation of R/W RNLP that uses phase fairness follows the pseudocode from  Ward and Anderson (2014). As resources are managed in dedicated queues and the resource bitmasks in our benchmark are typically only sparsely populated, we use an efficient iterator for bitmasks (see Table  9 ).
This is mostly due to the internal locking overhead. The R/W RNLP lock operation comprises three internal critical sections, adding much static overhead. On a single core and with just a few resources, the performance of all locks is next to each other, as Table  9  shows. But with an increasing number of cores, internal overhead increases and scalability decreases. On Intel, for a larger number of cores until the number of physical cores on the first CPU (  16 ) is reached (red box in Fig. 5  (B)), TATAS scales best, immediately followed by LLAB and R/W LLAB, then DGL, MRLock, and R/W DGL follow next with already more than twice the execution time when using 16 cores. The trend amplifies when crossing the boundary to the second CPU from core 17 on. Beyond the 32 available physical cores, the Linux kernel starts to schedule the tasks on each core's hardware thread sibling as well.
The data compendium The data compendium derives from a collection of 15,211 isolates for which both genomic and phenotypic data were collected by 23 of the partner countries across the continents of Asia, Africa, South America, and Europe. This collection will herein be referred to as the "full" dataset. An overview of the processing of the isolates is presented in  Fig   [17, 18]. The phylogenetic tree in Fig D in S1 File further highlights the strong population structure of this collection of isolates, with isolates clustering according to lineage. Typically undersampled in current databases and biobanks, the L3 isolates in this study represent the largest collection to date  [19]. Although the 15,211 M. tuberculosis isolates belonging to the full dataset were plated to determine their minimum inhibitory concentrations (MICs) to 13 antitubercular drugs, regular quality assurance checks detected problems with plate inoculation and reading in 2 laboratories, resulting in the removal of 2,922 isolates.
Resistance classification and distribution Unsurprisingly, given its size and bias towards the collection of resistant isolates, resistance to each of the 13 drugs is represented within the compendium (Fig  3A ). The drugs with the highest percentage of resistant isolates are the first-line drugs isoniazid and rifampicin (49. 0% and 38. 7%, respectively). Of the second-line drugs, levofloxacin had the highest proportion of resistant isolates in the dataset (17. 6%) and amikacin the lowest (7. 3%). A low proportion of isolates were resistant to the NRDs, bedaquiline (0. 9%), clofazimine (4. 4%), delamanid (1. 6%), and linezolid (1. 3%). Of the 12,289 isolates represented by the compendium, 6,814 (55. 4%) were resistant to at least 1 drug (Fig  3B ). For the purpose of describing 5 broader resistance categories present in the dataset, we assumed that all MICs that could not be read had susceptible phenotypes.
These 5 resistance categories comprise the following: isoniazid and rifampicin susceptible with resistance to another antitubercular drug, isoniazid resistant but rifampicin susceptible, RR/ MDR, pre-XDR (RR/MDR + fluoroquinolone resistance), and XDR (RR/MDR + fluoroquinolone resistance + resistance to a group A agent: bedaquiline or linezolid). Consequently, the calculated prevalence of MDR, XDR, etc. , in the dataset (Fig  3 ) are likely underestimates. Of the isolates resistant to one or more drugs, 22. 8% were resistant to isoniazid and not rifampicin, 68. 8% were either RR or MDR, and 8. 4% were resistant to at least 1 antitubercular drug, but notAU : PerPLOSstyle; italicsshouldnotbeusedinwordsforemphasis:Hence; allinstancesofitalicizedw isoniazid or rifampicin (Fig 3B  Briefly: Each isolate was DNA sequenced using an Illumina machine and plated onto 96-well plates (UKMYC5/6) containing 5-10× doubling dilutions of 13 antitubercular drugs for DST.
Associated metadata (including country of origin and processing laboratory) was recorded. DNA variant calling and analysis was performed using Clockwork and Minos  [47] ). After 14 days, MIC measurements were taken by a trained scientist using Vizion, and the plate was photographed to also measure the MIC using the automated AMyGDA software and citizen scientists from BashTheBug  [45]. After quality control procedures, phenotypic MIC data for 2,922 isolates were removed. The compendium therefore contains 15,211 isolates with WGS data ("full dataset"), 12,289 of which have matched quality assessed phenotypic data ("data compendium"). The raw sequence, VCFs, MICs, and binary resistance calls for the data compendium are presented in "CRyPTIC_reuse_table_20211019. csv" via an FTP site (see Methods), and the raw sequence and VCF files for those samples present in the full dataset are presented in "CRyPTIC_excluded_samples_20220607.
tsv" via the same FTP site (see Methods). The data tables GENOTYPES. csv, VARIANTS. csv, MUTATIONS. csv, SAMPLES. csv, and PHENOTYPES. csv used for the analyses presented in this manuscript are also accessible via the FTP site (see Methods contributed by these countries, respectively, were neither MDR nor RR. For Nepal and India, an especially high proportion of the MDR/RR isolates contributed were fluoroquinolone resistant (92. 9% and 69. 8%, respectively), which has been previously observed for this geographical region  [1].
Co-occurrence of drug resistance among the compendium isolates As we measured MICs to 13 drugs in parallel, we can ask whether, and how often, co-occurrence of drug resistance occurs among the isolates. We found isolates with all possible 2-drug resistant combinations in this dataset  (Fig 4A and Table G in S1 File). With the exception of correlations between drugs in the same class (rifabutin versus rifampicin, moxifloxacin versus levofloxacin), isoniazid resistance was the most strongly associated with resistance to each of the other drugs. Resistance to any of the drugs was also strongly associated with resistance to rifampicin. Of the second-line drugs, levofloxacin and moxifloxacin were more commonly seen as a second resistant phenotype than the injectable drugs kanamycin and amikacin.
Resistance to both drugs in the aminoglycoside class was common in the dataset; 90. 4% of amikacin-resistant isolates were also resistant to kanamycin, although significantly fewer kanamycin-resistant isolates were resistant to amikacin (72. 0%, p < 0. 00001) (Fig  4A ). In a similar fashion, a smaller proportion of RR isolates were resistant to rifabutin than rifabutin-resistant isolates that were resistant to rifampicin (91. 3%, 96. 8%, p < 0. 00001), while a smaller proportion of levofloxacin-resistant isolates were resistant to moxifloxacin than moxifloxacin-resistant isolates that were resistant to levofloxacin (78. 5%, 97. 6%, p < 0. 00001). Differences in drugs of the same class are also well documented by in vitro studies  [20] [21] [22]. Isolates resistant to the NRDs bedaquiline, clofazimine, delamanid, and linezolid were most likely to also be resistant to isoniazid, followed by rifampicin and rifabutin.
Genetic-based predictions of resistance The compendium was sampled in order to collect as broad as possible a representation of resistance mutations and mechanisms-it is therefore expected to be enriched for rare resistance mutations compared with a prospectively sampled dataset from 1 country. To establish a baseline measure of how much unexplained resistance there was in the compendium, based on a standard catalogue of resistance mutations, we compared genetic-based predictions of susceptibility and resistance to the binary phenotypes derived from MICs for 8 drugs and for all isolates in this compendium (FN and VME columns in Table  2 ). Since these data are enriched for resistance, the calculated error rates are not representative of how well such a method would perform in routine clinical use.
Case study on rifampicin monoresistance Around 1% of TB cases are rifampicin monoresistant (RMR), and the frequency is increasing  [1, 32]. The WHO does not recommend isoniazid for RMR treatment, despite it being effective; this is likely due to the reliance on assays such as Xpert MTB/RIF, which cannot distinguish between RMR and MDR. Use of isoniazid could improve treatment outcomes for RMR patients, which are currently similar to that of MDR TB, including a higher risk of death compared to drug-susceptible infections  [33, 34]. Due to its low natural prevalence, RMR has been poorly studied to date, but increasingly large clinical TB datasets, such as the one presented here, make its study now feasible. For this case study, we defined RMR as any isolate that is rifampicin resistant and isoniazid susceptible, and discounted isolates with no definite phenotype for either drug.
Of the 4,655 RR isolates in the compendium that also had a phenotype for isoniazid, 302 (6. 5%) were RMR. These isolates were contributed by 12 different countries, and we found South African and Nigerian contributions had a significantly higher proportion of RMR isolates than that of the total dataset at 17. 5% (p < 0. 00001) and 27. 3% (p = 0. 00534), respectively (Fig 6A ), compared with 6. 5% for the total dataset. We note that these proportions are influenced by sampling strategies, but the higher contribution of RMR isolates from South Africa is consistent with previous studies  [32].
Rifampicin monoresistance is incorrectly predicted by current diagnostics A widely used, WHO-endorsed diagnostic tool, the Xpert MTB/RIF assay, uses a proxy whereby any SNP detected in the "rifampicin-resistance determining region" (RRDR) of rpoB results in a prediction of MDR. However, the suitability of the proxy is dependent upon prevalence of RMR in the population  [32]. We tested the reliability of this on the 4,655 RR isolates in our dataset that had a phenotype for isoniazid (Fig  6B ). Of these isolates, 4,353 (93. 5%) were MDR and 302 (6. 5%) were RMRAU : PerPLOSstyle; numeralsa. Of the MDR isolates, 187 had no RRDR mutation, and therefore, 4. 0% of isolates in this study would be predicted as false negative MDR by the Xpert MTB/RIF assay. OfAU : PerPLOSstyle; numeralsarenotallowedatthebe the RMR isolates, 276 had a mutation in the RRDR of rpoB and so the Xpert MTB/RIF assay proxy would incorrectly predict 5.
9% of the RR isolates as false positive MDR cases. However, overall, the Xpert MTB/RIF assay proxy correctly predicts 89. 5% of the RR isolates as MDR and 0. 6% of the isolates as non-MDR in Depicted is a survey of the resistance-associated mutations present in the data compendium  [8, 26]. "VARIANT": nonsynonymous amino acid mutations are denoted by upper case letters, while nucleotide substitutions for noncoding sequences are denoted by lower case letters. Negative numbers denote substitutions in promoter regions; "GENE": genic region of interest in which "Variant" can be found; "n": number of phenotypically resistant isolates with "VARIANT"; "%": percentage of total phenotypically resistant isolates with "VARIANT". https://doi. org/10. 1371/journal. pbio. 3001721. t003 this dataset, which suggests it is a reasonably successful diagnostic tool with >90% accuracy for MDR classification of RR isolates.
As our dataset is oversampled for resistance, it likely contains a higher prevalence of RMR than the global average, and, hence, the Xpert MTB/RIF assay is likely to perform better on more representative data. However, the analysis shows how the increasing global levels of RMR TB cases could increase the number of false positive MDR diagnoses by the Xpert MTB/RIF assay, denying isoniazid treatment to a greater number of patients who would then be moved on to less effective drugs.
To date, several nonsynonymous RRDR mutations have been found in RMR M. tuberculosis isolates, including the resistance conferring mutations S450L, H445D, and D435Y, which are also seen in MDR isolates  [36, 37]. For both RMR and MDR isolates in this dataset, the most common rpoB RRDR mutation seen was S450L (63. 6% and 41. 1% of isolates, respectively; Fig  6C ). Five mutations were present in RMR isolates that were not seen in MDR isolates: S428G, S441A, S441V, S450M, and S450Q; however, these were seen at low prevalence (<2%) of RMR isolates. We found more RMR isolates had His445 mutated than MDR isolates (27. 8% of RMR and 9. 5% of MDR, p < 0. 00001), and mutations at Ser450 and Asp435 were more prevalent in MDR isolates than RMR isolates (43. 7% of RMR and 65. 8% of MDR (p < 0. 00001), and 9.
Discussion This compendium of M. tuberculosis clinical isolates is the result of an extensive global effort by the CRyPTIC consortium to better map the genetic variation associated with drug resistance. Through its sheer size and by oversampling for resistance, the compendium gives an unparalleled view of resistance and resistance patterns among the panel of 13 antitubercular compounds studied. This study serves to summarise the data within the compendium and to highlight the existence of the open-access resource to the wider community to help better inform future treatment guidelines and steer the development of improved diagnostics. Starting with first-line drugs, molecular based diagnostic assays have vastly improved the detection of and the speed at which we find DR-TB cases, resulting in improved quality of care for patients.
However, relying solely on these diagnostic methods has several drawbacks. Aside from the Xpert MTB/RIF assay potentially increasing false positive MDR diagnoses as discussed earlier in the RMR case study, the assay assumes isoniazid resistance upon detection of rifampicin resistance. Thus, less is known about the prevalence of mono-isoniazid resistance or "true" cases of MDR (confirmed rifampicin and isoniazid resistance)  [1]  and with large datasets such as this compendium, we can further investigate these important and rarer clinical phenotypes (like that of RMR in our case study). Another example of a rarer phenotype is that of isoniazid-resistant and rifampicin-susceptible (Hr-TB) isolates; a greater number of these were contributed by CRyPTIC countries than RMR isolates (n = 1,470 versus n = 302), a pattern also recently observed in a global prevalence study  [38].
A modified 6-month treatment regimen is now recommended for Hr-TB (rifampicin, ethambutol, levofloxacin, and pyrazinamide), and as a result of inadequate diagnosis, many of the 1. 4 million global Hr-TB estimated cases would have received inadequate and unnecessarily longer treatment regimens  [1, 39]. Encouragingly, CRyPTIC isolates with an Hr-TB background exhibited relatively low levels of resistance to other antitubercular drugs, including those in the augmented regimen (Fig  4C ). However, without appropriate tools to assess and survey this, we will continue to misdiagnose and ineffectively treat these clinical cases. In 2018, CRyPTIC and the 100,000 Genomes project demonstrated that genotypic prediction from WGS correlates well with culture-based phenotype for first-line drugs, which is reflected in our summary of the genetic catalogue applied to this dataset (Table  3 )  [8].