
==== Front
PLoS Comput Biol
PLoS Comput Biol
plos
PLOS Computational Biology
1553-734X
1553-7358
Public Library of Science San Francisco, CA USA

39226337
PCOMPBIOL-D-24-00267
10.1371/journal.pcbi.1011914
Software
Biology and Life Sciences
Evolutionary Biology
Evolutionary Systematics
Phylogenetics
Biology and Life Sciences
Taxonomy
Evolutionary Systematics
Phylogenetics
Computer and Information Sciences
Data Management
Taxonomy
Evolutionary Systematics
Phylogenetics
Physical Sciences
Mathematics
Applied Mathematics
Algorithms
Machine Learning Algorithms
Research and Analysis Methods
Simulation and Modeling
Algorithms
Machine Learning Algorithms
Computer and Information Sciences
Artificial Intelligence
Machine Learning
Machine Learning Algorithms
Biology and Life Sciences
Ecology
Community Ecology
Ecology and Environmental Sciences
Ecology
Community Ecology
Biology and Life Sciences
Taxonomy
Computer and Information Sciences
Data Management
Taxonomy
Physical Sciences
Mathematics
Probability Theory
Statistical Distributions
Biology and Life Sciences
Ecology
Ecological Metrics
Species Diversity
Ecology and Environmental Sciences
Ecology
Ecological Metrics
Species Diversity
Computer and Information Sciences
Software Engineering
Programming Languages
Engineering and Technology
Software Engineering
Programming Languages
Physical Sciences
Mathematics
Algebra
Linear Algebra
Accelerating joint species distribution modelling with Hmsc-HPC by GPU porting
Accelerating joint species distribution modeling with Hmsc-HPC
https://orcid.org/0000-0002-8306-475X
Rahman Anis Ur Conceptualization Investigation Methodology Resources Software Validation Visualization Writing – original draft Writing – review & editing 1
https://orcid.org/0000-0003-3040-0307
Tikhonov Gleb Conceptualization Data curation Formal analysis Investigation Methodology Project administration Resources Software Validation Visualization Writing – original draft Writing – review & editing 2
Oksanen Jari Conceptualization Investigation Methodology Resources Software Supervision Validation 2
https://orcid.org/0000-0002-8713-4559
Rossi Tuomas Methodology Resources Software Validation Writing – review & editing 3
https://orcid.org/0000-0001-9750-4421
Ovaskainen Otso Conceptualization Data curation Funding acquisition Investigation Project administration Resources Supervision Validation Writing – review & editing 1 2 *
1 Department of Biological and Environmental Science, Faculty of Mathematics and Science, University of Jyväskylä, Jyväskylä, Finland
2 Organismal and Evolutionary Biology Research Programme, Faculty of Biological and Environmental Sciences, University of Helsinki, Helsinki, Finland
3 CSC – IT Center for Science Ltd., Espoo, Finland
Scarpino Samuel V. Editor
Northeastern University, UNITED STATES OF AMERICA
The authors have declared that no competing interests exist.

* E-mail: otso.t.ovaskainen@jyu.fi
9 2024
3 9 2024
20 9 e101191412 2 2024
26 7 2024
© 2024 Rahman et al
2024
Rahman et al
https://creativecommons.org/licenses/by/4.0/ This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.

Joint species distribution modelling (JSDM) is a widely used statistical method that analyzes combined patterns of all species in a community, linking empirical data to ecological theory and enhancing community-wide prediction tasks. However, fitting JSDMs to large datasets is often computationally demanding and time-consuming. Recent studies have introduced new statistical and machine learning techniques to provide more scalable fitting algorithms, but extending these to complex JSDM structures that account for spatial dependencies or multi-level sampling designs remains challenging. In this study, we aim to enhance JSDM scalability by leveraging high-performance computing (HPC) resources for an existing fitting method. Our work focuses on the Hmsc R-package, a widely used JSDM framework that supports the integration of various dataset types into a single comprehensive model. We developed a GPU-compatible implementation of its model-fitting algorithm using Python and the TensorFlow library. Despite these changes, our enhanced framework retains the original user interface of the Hmsc R-package. We evaluated the performance of the proposed implementation across various model configurations and dataset sizes. Our results show a significant increase in model fitting speed for most models compared to the baseline Hmsc R-package. For the largest datasets, we achieved speed-ups of over 1000 times, demonstrating the substantial potential of GPU porting for previously CPU-bound JSDM software. This advancement opens promising opportunities for better utilizing the rapidly accumulating new biodiversity data resources for inference and prediction.

http://dx.doi.org/10.13039/501100002341 Academy of Finland 336212 https://orcid.org/0000-0001-9750-4421
Ovaskainen Otso http://dx.doi.org/10.13039/501100002341 Academy of Finland 345110 https://orcid.org/0000-0001-9750-4421
Ovaskainen Otso http://dx.doi.org/10.13039/501100000781 European Research Council 856506 https://orcid.org/0000-0001-9750-4421
Ovaskainen Otso http://dx.doi.org/10.13039/501100000781 European Research Council 101057437 https://orcid.org/0000-0001-9750-4421
Ovaskainen Otso This project was funded by the Academy of Finland (grant no. 336212 and 345110) to OO, and the European Union: the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No 856506 to OO; ERC-synergy project LIFEPLAN) and the HORIZON-INFRA-2021-TECH-01 project 101057437 (Biodiversity Digital Twin for Advanced Modelling, Simulation and Prediction Capabilities) to OO. Views and opinions expressed are those of the author(s) only and do not necessarily reflect those of the European Union or the European Commission. Neither the European Union nor the European Commission can be held responsible for them. The funders had no role in study design, data collection and analysis, decision to publish, or preparation of the manuscript. PLOS Publication Stagevor-update-to-uncorrected-proof
Publication Update2024-09-13
Data AvailabilityThe Hmsc-HPC add-on package is available for download from its designated GitHub webpage https://github.com/hmsc-r/hmsc-hpc. The repository includes preprocessed Australian plant data used in this study as CSV tables. Moreover, the repository also includes the R codes used in the Australian plant datas.
Data Availability

The Hmsc-HPC add-on package is available for download from its designated GitHub webpage https://github.com/hmsc-r/hmsc-hpc. The repository includes preprocessed Australian plant data used in this study as CSV tables. Moreover, the repository also includes the R codes used in the Australian plant datas.
==== Body
pmcIntroduction

The past decade has seen a transformative revolution in data acquisition and sampling methodologies, making large-scale data accessible for ecological research on species communities [1]. This emergence of novel data resources not only enhances our fundamental understanding of biodiversity but also establishes a new foundation for sustainable management in the context of global change. However, converting this data into reliable scientific insights presents significant challenges in terms of data processing and interpretation. A key statistical development in species community analysis is joint species distribution modelling (JSDM), which combines Species Distribution Modelling with ordination-like approaches to community assembly assessment [2, 3]. JSDM has become widely used by ecologists and has attracted significant interest from statisticians for further methodological development. Several user-friendly software packages have been created, offering diverse model structures and fitting algorithms. [4–11].

Since their introduction, the computational scalability of JSDMs for large community data has been a critical research focus. Initially formulated as a covariate-constrained multivariate probit (MVP) model [2], JSDMs faced challenges with the small-n-large-p statistical issue when applied to many species, due to the quadratic growth in estimated parameters with species count. This limitation prompted the search for alternative formulations, leading to the widespread adoption of generalized linear latent variable models (GLLVM) [3] as the most common design. Subsequent developments integrated Gaussian Processes to account for potential spatial or spatiotemporal autocorrelation in community data [12, 13], which initially scaled poorly with the number of spatial locations. Further progress in spatial statistics has since enhanced the scalability of these spatial JSDMs [14, 15]. Meanwhile, research has also significantly advanced the computational efficiency of classic GLLVM fitting through novel techniques for approximating the integration of latent variables [9, 16]. Additionally, scalability improvements for previously limited MVP-based JSDM formulations have included strategies such as Monte Carlo integration with stochastic gradient descent and mini-batching [10], as well as a two-stage divide-and-conquer approach [17].

Recent developments in model-fitting approaches have enhanced the computational scalability of GLLVM and MVP. However, these improvements have not been extended to more complex JSDM variants. Complex JSDMs not only link species data with environmental predictors but also explore dependencies on species traits or phylogenetics. Additionally, ecologists often employ hierarchical multi-level designs [18], which GLLVM or MVP only partially addresses by assuming the statistical interchangeability of observed sampling units after adjusting for covariates. As ecological datasets expand, their heterogeneity typically increases, underscoring the need for accelerated model-fitting methods, especially for large data studies. Motivated by this unmet need, our study explores a complementary approach to accelerating JSDM fitting: instead of developing new model-fitting algorithms, we aim to accelerate an existing algorithm through a novel implementation that leverages modern high-performance computing (HPC) resources.

In this work, we focus on the hierarchical modelling of species communities (HMSC) [7]. HMSC allows researchers to estimate how species occurrences depend on environmental predictors and how species-environment relationships are influenced by species traits and phylogenetic relationships. It further accommodates various study designs, including spatially or temporally explicit data and multi-level designs [19]. The HMSC framework is implemented in the Hmsc R-package, which enables users to define and fit various model types, and subsequently post-process model outputs for prediction and inference [20]. While the Hmsc R-package has demonstrated strong predictive performance [21], it faces computational inefficiencies with large datasets [22], prolonging model-fitting processes and limiting its utility for extensive ecological datasets, even with simpler GLLVM models [10].

To address this computational bottleneck, we developed Hmsc-HPC package, an extension that enhances the functionality of the Hmsc R-package by efficiently utilizing graphical processing units (GPUs) and HPC infrastructure. The central innovation of Hmsc-HPC is the acceleration of the model fitting process by transitioning from R-coded calculations to a TensorFlow-based computational backend capable of leveraging GPU acceleration [23]. By harnessing the parallel processing capabilities of GPUs, we significantly speed up the execution of the block-Gibbs sampler used in HMSC fitting. This acceleration markedly reduces the time required for model fitting and addresses performance limitations related to dataset size, thereby improving the package’s capability to handle large datasets that were previously computationally prohibitive.

Design and implementation

Integrating Hmsc-HPC with Hmsc R-package

The Hmsc R-package provides a comprehensive statistical framework for integrating data on species occurrence records, environmental covariates, species traits, and phylogenetic information while accounting explicitly for hierarchical, spatial, or temporal study designs [19]. Statistically, HMSC combines elements of generalized linear models and latent factor approaches within a hierarchical modelling framework. HMSC is fitted using Bayesian inference via Markov chain Monte Carlo (MCMC) sampling. The Hmsc R-package enables ecologists to define models, fit them to data, and utilize the fitted models for prediction and inference (Fig 1):

Setting model structure and data: In the first step, the user defines the desired model structure, which reflects the specifics of the collected data and is tailored to address specific ecological questions of interest. This step also includes pre-processing the original data into the assumed input format, specifying the optional model features and fine-tuning prior distributions of the model if necessary.

Model fitting: The defined model is then fitted to the provided data using MCMC sampling. Specifically, the Hmsc R-package employs a block-Gibbs sampler, which iterates over blocks (naturally defined subsets) of HMSC parameters. Within each block, parameters are updated collectively while keeping others fixed at their current values, sampled from analytically derived conditional distributions due to the conditionally conjugate design of HMSC. These distributions are available in closed form. Subsequently, the resulting MCMC chains undergo processing through trimming and thinning to mitigate the effects of initial chain positions and autocorrelation. This refinement aims to approximate the true, non-tractable posterior parameter distribution in HMSC using a finite number of samples.

MCMC fit diagnostics: In this step, the validity of the acquired MCMC chains is assessed using both formal criteria (such as Gelman-Rubin diagnostics [24]) and visual inspection of trace plots.

Inference and predictions: After obtaining a reliable posterior approximation, this step encompasses the operations that the user wishes to perform with the fitted model. These operations may include evaluating the model’s explanatory and predictive capabilities, exploring parameter estimates, and making predictions [7, 19].

10.1371/journal.pcbi.1011914.g001 Fig 1 Pipeline of community analysis with HMSC.

The left path represents the standard approach using the Hmsc R-package [20]. The alternative on the right describes the newly developed Hmsc-HPC augmentation, which allows for model-fitting deployment on HPC infrastructure.

The practical use of the Hmsc R-package for large models is hindered by the computational intensity of Step 2, due to two main reasons. Firstly, Bayesian inference with MCMC methods is inherently more computationally demanding than approximate Bayesian methods, such as integrated nested Laplace approximations (INLA) or empirical Bayes methods. These approximate methods are designed to be more computationally efficient while still providing reliable estimates, unlike MCMC which aims to assess the entire posterior distribution–a significantly more complex and resource-intensive task. Secondly, from a software engineering standpoint, Step 2 in the Hmsc R-package primarily relies on native R computational routines, which are less numerically efficient compared to implementations in compiled programming languages [25]. This reliance on a less efficient computational framework results in significantly poorer performance for the Hmsc R-package compared to recently introduced alternatives tailored for highly accelerated model fitting [10].

Here we overcome the computational limitations of the Hmsc R-package by replacing its original model-fitting implementation with a version designed for HPC hardware. This new package, called Hmsc-HPC, is optimized for deployment on GPUs, which have demonstrated their effectiveness in various computationally intensive tasks beyond their traditional graphical applications in recent years. Despite the typically sequential nature of MCMC fitting algorithms, the computations within each MCMC step can benefit significantly from breaking down into small, independent tasks that can run concurrently on GPU cores. The majority of operations within the block-Gibbs algorithm are algebraic in nature, lending themselves well to a “single instruction, multiple data” paradigm. By parallelizing these computations across the processing units of a GPU, calculations can be executed simultaneously, leading to substantial efficiency gains [26]. Furthermore, the implementation can run on multicore CPUs as well as GPUs, leveraging Python and TensorFlow dependencies for optimal performance across different devices.

To implement Hmsc-HPC, we redesigned and re-implemented the block-Gibbs sampler routine of the Hmsc R-package using Python language and the TensorFlow library [23]. We opted for TensorFlow over lower-level GPU programming options due to its robust application programming interface, which includes a wide array of linear algebra and statistical routines. This choice significantly reduced the need for developing standard low-level numerical operations or relying on third-party tools. TensorFlow’s computational graph concept is fundamental to its functionality and efficiency. It represents the entire computation algorithm as a directed graph, where nodes correspond to mathematical operations and edges denote the flow of data between these operations. This graph-based approach offers several advantages, such as portability, optimization opportunities, and support for distributed computing. Crucially, it decouples the definition of computation from its execution, enabling lazy evaluation or deferred execution. This separation allows TensorFlow to optimize the computation graph by combining operations for efficiency and potentially distributing non-sequential computations across multiple devices for concurrent processing. Graph execution involves running computations on the constructed graph, typically within a session context. This process entails evaluating specific nodes or operations to generate results. The clear distinction between graph construction and execution not only enhances TensorFlow’s performance but also facilitates flexibility and extensibility in constructing complex data processing pipelines [27].

In addition to developing the Python code with the TensorFlow-based block-Gibbs sampler implementation, we made corresponding modifications to the Hmsc R-package. These changes facilitate the seamless integration of HPC resources during the model fitting phase, as illustrated in Fig 1:

Setting model structure and data: Initially, the user defines the model within R using the standard workflow of the Hmsc R-package. This step also involves initializing the starting positions of the MCMC chains.

Exporting a specified model to Python: At this stage, the user saves the model as an RDS file within the R session, which includes the model specification and MCMC settings.

Model fitting with TensorFlow: The core step involves reading the RDS file into an independent Python session. Model fitting occurs in Python using the GPU-compatible MCMC sampler implemented in TensorFlow. This process begins with a compilation of the TensorFlow computational graph, which is subsequently executed. The TensorFlow graph can be executed on any device with appropriate Python and TensorFlow configurations. For instance, it can run on a CPU in the user’s laptop and still offer significant speed improvements in model fitting. However, our implementation is optimized for GPUs dedicated to scientific computations, aiming to achieve the maximum performance for computationally intensive tasks.

Exporting the posterior to R: Once the posterior distribution is obtained, the user saves it as an RDS file within the Python session.

Diagnostics, inference, visualization, and prediction: In this final step, the user imports the RDS file back into an R session. Post-fitting procedures continue within the standard workflow of the Hmsc R-package, independent of the framework used for the model fitting.

In addition to leveraging intra-chain low-level parallelization to harness GPU cores for enhanced performance, we have also implemented an interface that allows for the simultaneous computation of multiple MCMC chains. This approach is particularly advantageous in HPC infrastructures, such as a computational cluster, where multiple jobs from a user can be placed simultaneously. The internal job scheduler then assigns these jobs to available computational nodes automatically. Since MCMC chains operate independently and do not require communication with each other, this setup is ideal for parallelization across chains. Each job can handle the computation of one or a few chains, maximizing efficiency and utilizing computational resources effectively.

In summary, our approach retains the user interface of the Hmsc R-package while enabling the utilization of HPC infrastructure and GPU acceleration during the most computationally intensive step. This integrated, cross-language workflow leverages the strengths of R, Python, and TensorFlow to provide a streamlined and efficient methodology for analyzing large species community data with models that can account for complex dependency structures.

Performance comparison

We conducted a performance assessment of the GPU-accelerated HMSC implementation across different models characterized by varying data dimensions, including the numbers of sampling units and species analyzed. Additionally, we explored diverse model structures that varied in whether or not phylogenetic information was included, the design of random levels, and the choice of spatial method. The execution of the Hmsc R-package used as a baseline reference, was performed and timed on a consumer-level laptop CPU. In contrast, the Hmsc-HPC implementation was run on NVIDIA Volta V100 GPUs located in the AI partition of the Puhti cluster, operated by CSC—IT Center for Science, Finland.

We set up the computational performance experiment using the same case study as previously employed to compare the numerical performances of alternative spatial methods in the Hmsc R-package implementation [14]. This case study serves as an illustrative example of the challenges encountered when using the Hmsc R-package with large datasets, even for relatively simple models. The dataset consists of spatially-referenced recordings of plant presence-absence in South-West Australia, along with several environmental predictors. After excluding most rare species (those with fewer than five occurrences), the dataset comprises of 622 species recorded at 25,955 locations. Additionally, the dataset includes a set of binary traits for each species. We also incorporated information regarding species’ taxonomy based on the GBIF Backbone taxonomy [28].

We conducted experiments closely following the design of the original study [14], evaluating the model fitting performance for five distinct variants of HMSC models. These model variants cover different approaches to handle the spatial context of the data [12, 14]: 1) a spatially ignorant model, 2) a spatial model with a full Gaussian process (GP) structure for latent factors, 3) a spatial model with predictive GP approximation [29] (PGP, with 55 predictive process knots distributed along a uniform hexagonal grid spanning the study area), 4) a spatial model with nearest neighbour GP approximation [30] (NNGP, with ten neighbours), and 5) a spatially ignorant model that accounts for taxonomical relationships, thus using taxonomy as a proxy for phylogeny to estimate the phylogenetic signal in species responses to environmental predictors [7]. All models included the data on species traits. We introduced variation in two key dimensions: the number of species (ns = {40, 160, 622}) and the number of sites (ny = {100, 200, 400, 800, 1600, 3200, 6400, 12800, 25955}). This allowed us to create diverse sub-datasets, ranging from reasonably small data sizes to fairly large datasets. To facilitate comparison across varying data dimensions, we kept the number of latent factors fixed at 10. For each sub-dataset, we fitted each of the five HMSC variants with both the Hmsc R-package and Hmsc-HPC, excluding cases for which the full GP spatial model was infeasible due to insufficient RAM/VRAM. We recorded the total fitting time for each model-dataset combination and quantified the execution time required for a single cycle of the block-Gibbs sampler. While different models may require different numbers of samples to converge, our primary focus is the relative comparison between alternative implementations of the same mathematical algorithm. Therefore, comparing the computational effort per Gibbs cycle provides a relevant characterization of the observed differences.

Results

The results presented in Fig 2 clearly demonstrate the computational benefits of fitting HMSC models on a high-end specialized GPU device. The speed-up of Hmsc-HPC over the Hmsc R-package increases with the size of the dataset and the overall computation time. Notably, even for a non-spatial model, the GPU-based execution outperforms the similar R-based execution by nearly 1000 times for the largest dataset, equating to an acceleration of three orders of magnitude. For full GP and PGP models, this acceleration is evident even with smaller numbers of sites, as these models involve operations with large matrices that are highly suitable for GPU acceleration. Models incorporating taxonomy exhibit a similar pattern, but the acceleration is more closely aligned with the number of species rather than the variation in the number of sites.

10.1371/journal.pcbi.1011914.g002 Fig 2 Performance comparison on GPU.

Panels A-E represent execution time per block-Gibbs cycle for different HMSC models with respect to the number of sites and species. Red, blue and green colours stand for ns = 40, 160 and 622 species correspondingly. Solid lines depict the execution times for model fitting with the R backend, and dashed lines for fitting with the TensorFlow backend. In some panels, the lines of different colours overlap due to the minor effect of the number of species on execution times. Panel F summarizes the overall comparison of execution times between the R backend and the TensorFlow backend. This figure shows the same data as depicted in panels A-E, but the times are multiplied by 200,000 to exemplify total computation times for a typical number of MCMC iterations in a model fit with a transient of 100,000 and 1000 samples obtained with a thinning of 100. Dashed grey lines indicate ratios between TensorFlow and R computational performance, thus showing how many times faster or slower TensorFlow is compared to R. The symbols and colours represent different model types and numbers of species, matching those used in Panels A-E (as indicated in the legend).

In contrast to the other model variants, the results for the NNGP models did not indicate a clear benefit from using Hmsc-HPC. The HMSC algorithm for handling the NNGP approximation for spatial latent factors relies on sparse linear algebra operations, specifically the Cholesky decomposition of sparse symmetric positive definite matrices and left-hand division with sparse triangular matrices. Currently, these operations are not available in TensorFlow. To address this, we used the capability to “inject” the necessary sparse operations from another Python package into the TensorFlow graph, resulting in these operations being conducted on the CPU. The introduced device-host communication overhead appears to bottleneck the overall execution, diminishing the benefits of accelerated GPU execution for the remaining operations. The NNGP approaches have been identified as superior to low-rank representations of spatial covariance matrices [14, 30, 31], and thus solving this bottleneck is a key challenge for future work. However, we note that the current Hmsc-HPC package enables fitting models to large spatial data using the GP and especially the PGP approaches.

Conclusion

In this study, we introduced a novel Hmsc-HPC package that provides a parallel and efficient implementation of HMSC fitting using a GPU-compatible TensorFlow backend. This development is designed as an optional add-on to the existing, well-established Hmsc R-package to enhance its usability for JSDM practitioners. Our evaluation, conducted on an extensive dataset of species occurrence records, demonstrates that the new implementation yields speed improvements of over 1000 times compared to the Hmsc R-package approach when the model fitting problem is sufficiently computationally intense to start with (Fig 2). This effectively means that models which previously required five years to fit can now be processed in just one day. The achieved speed-up significantly expands the practical boundaries of fitting HMSC models to large ecological datasets.

While GPU utilization is standard in machine learning, its application in statistical modelling remains relatively uncommon. To our knowledge, among existing JSDM software, only s-jSDM [10] is designed to leverage GPU devices. Our findings on the speed-up achieved through GPU porting complement recent developments in model fitting approaches that have greatly advanced scalability for JSDMs, particularly on structurally simpler models. These results underscore the potential benefits of further developing JSDMs to target GPU acceleration. However, our work also highlights challenges with GPU porting, such as the limited availability of efficient sparse linear algebra routines in TensorFlow, which hindered the implementation of computationally efficient approaches for NNGP models.

Looking forward, we outline four directions for advancing Hmsc-HPC and potentially other GPU porting efforts in JSDM. First, recent studies have extended the NNGP method [31], previously viewed as the pinnacle of scalable spatial statistics, to generalize neighborhood-only conditional dependence to blocks of spatial locations [32] and proposed algorithms independent of sparse linear algebra [33]. GPU-based implementations of such block spatial models may be computationally advantageous over the NNGP models. Second, while here we implemented a fixed floating-point precision (FPP), it may be advantageous to use mixed FPP within the model fitting algorithm [34], thereby leveraging enhanced GPU acceleration with low FPP for precision-insensitive calculations. Third, leveraging TensorFlow’s auto-differentiation capabilities enables efficient integration of gradient-based generic MCMC samplers like Hamiltonian Monte Carlo [35] into block-Gibbs fitting algorithms used in Hmsc-HPC. This hybrid MCMC sampling approach may mitigate the drawbacks of individual sampling schemes, yielding universally superior MCMC convergence properties at the cost of minor additional computational overhead [36]. Finally, we aim to broaden our evaluation across diverse datasets and hardware configurations, including those incorporating explicit phylogenetic information. These efforts will enhance our understanding of the computational and predictive capabilities of our enhanced HMSC framework.

We thank CSC—IT Center for Science, Finland for providing access to HPC infrastructure and high-end GPU devices. Jesse Harrison and Jussi Heikonen from CSC significantly contributed to the design and support of this work on CSC computing platforms. Matt White kindly provided a taxonomy of the plant species used in the case study. We appreciate discussions and initial explorations with Graham Taylor and Sara El-Shawa on alternative HPC software platforms, among which we selected TensorFlow for this work.

10.1371/journal.pcbi.1011914.r001
Decision Letter 0
O'Dwyer James Section Editor
Scarpino Samuel V. Academic Editor
© 2024 O'Dwyer, Scarpino
2024
O'Dwyer, Scarpino
https://creativecommons.org/licenses/by/4.0/ This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Submission Version0
16 Apr 2024

Dear Dr Rahman,

Thank you very much for submitting your manuscript "Accelerating joint species distribution modeling with Hmsc-HPC: A 1000x faster GPU deployment" for consideration at PLOS Computational Biology.

As with all papers reviewed by the journal, your manuscript was reviewed by members of the editorial board and by several independent reviewers. In light of the reviews (below this email), we would like to invite the resubmission of a significantly-revised version that takes into account the reviewers' comments.

I agree with the reviewers that this is manuscript presents an interesting approach to a persistent problem in ecology. However, I also agree that more work is needed to appropriately describe the direct contributions of this work and to ground the work in existing literature. The authors should also consider modifying the title to more accurately describe what the 1000x speed-up is relative to and/or simply remove that from the title. I do also agree with reviewer 3 that fewer end users may be familiar with Python and it is worth a few sentences outlining the added complexity of both running code against GPUs and using Python as compared to R (I'm not trying to start an argument about the merits of various languages, but I doubt many people would defend Python's package mgmt).

We cannot make any decision about publication until we have seen the revised manuscript and your response to the reviewers' comments. Your revised manuscript is also likely to be sent to reviewers for further evaluation.

When you are ready to resubmit, please upload the following:

[1] A letter containing a detailed list of your responses to the review comments and a description of the changes you have made in the manuscript. Please note while forming your response, if your article is accepted, you may have the opportunity to make the peer review history publicly available. The record will include editor decision letters (with reviews) and your responses to reviewer comments. If eligible, we will contact you to opt in or out.

[2] Two versions of the revised manuscript: one with either highlights or tracked changes denoting where the text has been changed; the other a clean version (uploaded as the manuscript file).

Important additional instructions are given below your reviewer comments.

Please prepare and submit your revised manuscript within 60 days. If you anticipate any delay, please let us know the expected resubmission date by replying to this email. Please note that revised manuscripts received after the 60-day due date may require evaluation and peer review similar to newly submitted manuscripts.

Thank you again for your submission. We hope that our editorial process has been constructive so far, and we welcome your feedback at any time. Please don't hesitate to contact us if you have any questions or comments.

Sincerely,

Samuel V. Scarpino

Academic Editor

PLOS Computational Biology

James O'Dwyer

Section Editor

PLOS Computational Biology

***********************

I agree with the reviewers that this is manuscript presents an interesting approach to a persistent problem in ecology. However, I also agree that more work is needed to appropriately describe the direct contributions of this work and to ground the work in existing literature. The authors should also consider modifying the title to more accurately describe what the 1000x speed-up is relative to and/or simply remove that from the title. I do also agree with reviewer 3 that fewer end users may be familiar with Python and it is worth a few sentences outlining the added complexity of both running code against GPUs and using Python as compared to R (I'm not trying to start an argument about the merits of various languages, but I doubt many people would defend Python's package mgmt).

Reviewer's Responses to Questions

Comments to the Authors:

Please note here if the review is uploaded as an attachment.

Reviewer #1: Review of "Accelerating joint species distribution modeling with Hmsc-HPC: A 1000x faster GPU deployment

Rahman et al. present an exciting GPU implementation of Hmsc to fit a multitude of complex joint species distribution models. This is a very impressive contribution, and one that will be utilized greatly by the ecological community. Overall, I found the manuscript an appropriate length for communicating a software advancement. However, I found certain aspects of the manuscript to potentially overstate the value of Hmsc-HPC, particularly in the context of fitting spatially-explicit models, which I believe the authors should address prior to publication.

Major comments

1. Benefits of Hmsc-HPC for spatial models: Figure 2 clearly highlights the benefits of Hmsc-HPC for non-spatial and phylogenetic models, which is quite exciting given these models likely comprise a large majority of the models fit by the Hmsc user community. However, as the authors point out, there were minimal benefits, if any at all, for the GPU implementation of NNGP models, which also showed fairly close correspondence with the model run times for the GP and predictive process models when implemented in Hmsc-HPC. This leads me to ask the question: is it worthwhile for an Hmsc user who wants to fit a large spatial model to use the GPU implementation over the existing Hmsc-R package functionality for NNGPs? It is clear from Panel B that Hmsc-HPC yields clear benefits for fitting full GP models, but given the very good performance of NNGP models at closely approximating a full GP (e.g., Datta et al. 2016), is it realistic to expect a GP JSDM to be fit by an ecologist with anything more than 100-200 spatial locations? Further, while the predictive process model also showed substantial improvements in Hmsc-HPC, predictive process models and other low rank approximations to GPs are known to oversmooth (Stein 2014), which is something many of the authors of this manuscript found in a previous manuscript with this exact data set (Tikhonov et al. 2020). NNGPs do not have the same oversmoothing issues. While the predictive process models with Hmsc-HPC did have lower run times across the board compared to the NNGP models in Hmsc-R, it is not possible to directly compare the approaches due to (1) potential differences in mixing/convergence of the MCMC chains; (2) differences in model performance that may result from using too few knots in the predictive process approximation (here the authors use 55 while in Tikhonov et al. 2020 1026 knots were used, a substantial increase in run time) or too few neighbors (10 neighbors here vs. 20 in Tikhonov et al. 2020). I know this is not the objective of the performance comparison, as the authors point out in lines 210-214. However, given the lack of substantial improvements for the NNGP models, and the potential for the NNGP models implemented in Hmsc-R to outperform predictive process models implemented in Hmsc-HPC, I do not feel that there is conclusive evidence of Hmsc-HPC providing improvements in fitting spatial models relative to Hmsc-R. In my opinion, this would require a substantial comparison study of the models in terms of run times to convergence, predictive performance, etc. This would be a substantial undertaking, and something I do not think is necessary for this manuscript. I am not denying the benefits of Hmsc-HPC for fitting nonspatial or phylogenetic models; those findings are extremely clear. However, I believe the authors should more explicitly state that a more robust assessment/comparison of the NNGP/predictive process models under both platforms should be a future avenue of research in order to best determine the most effective approach to fitting spatial models.

2. Title: the "1000x faster GPU deployment" is context dependent, as it depends on the model type and size of the data set. The 1000x improvement, as the authors point out in the abstract, is for the largest data set (over 20,000 points), which I would guess is larger than the data sets most Hmsc users work with. Thus, I find this title overstated, and would suggest removing the "1000x faster GPU deployment" and instead only including that in the abstract where the proper context for it can be provided.

Minor comments:

+ Line 26-28: it may not be clear to ecologists reading the paper that "Hmsc-HPC" is not a new R package, and rather is an extension written in Python that needs to be installed separately from the Hmsc-R CRAN implementation. I would suggest including this information explicitly here.

+ Line 137-138: does this mean the user must have familiarity with Python, or is this all accomplished directly through R? Some more detail, and potentially a reference to an online example of how this is done with the package, would be helpful.

+ Lines 192-195: the authors do not give appropriate citation for the predictive process (Banerjee et al. 2008) or NNGPs (Datta et al. 2016). These should be cited accordingly.

References

+ Banerjee, S., Gelfand, A. E., Finley, A. O., & Sang, H. (2008). Gaussian predictive process models for large spatial data sets. Journal of the Royal Statistical Society Series B: Statistical Methodology, 70(4), 825-848.

+ Datta, A., Banerjee, S., Finley, A. O., & Gelfand, A. E. (2016). Hierarchical nearest-neighbor Gaussian process models for large geostatistical datasets. Journal of the American Statistical Association, 111(514), 800-812.

+ Stein, M. L. (2014). Limitations on low rank approximations for covariance matrices of spatial data. Spatial Statistics, 8, 1-19.

+ Tikhonov, G., Duan, L., Abrego, N., Newell, G., White, M., Dunson, D., & Ovaskainen, O. (2020). Computationally efficient joint species distribution modeling of big spatial data. Ecology, 101(2), e02929.

Reviewer #2: I revised the manuscript entitled “Accelerating joint species distribution modeling with Hmsc-HPC: A 1000x faster GPU deployment”. In this manuscript, authors introduced a new package to create JSDM. The manuscript is straightforward and clear, and the experiment performed to test the performance between Hmsc-R and Hmsc-HPC is appropriate. The tutorial provided also worked well and was very didactic. Perhaps, in the future, the package's authors could create a web page (e.g., with pkgdown) with tutorials for different modeling situations. One of the points I would like to highlight about the authors is that they integrate the two programming languages (R and Python). This will undoubtedly stimulate the use of Hmsc-HPC by former Hmsc-R users and others who only use R as a programming language. It is very exciting to see the speed at which JSDMs can be constructed, which in many other conditions would be prohibitive. I believe that the improvements that this package will bring to the already widely used Hmsc-R package will be of extreme importance for the development of these models, enhancing their use in new applications in regions with many samples or with many species.

Reviewer #3: The manuscript presents a new GPU-based, implementation of the HMSC fitting software for Joint Species Distribution Models. HMSC fits JSDMs in a Bayesian setting using MCMC, but since the original package implements those routines in the R programming language a large speed-up is to be gained by using the TensorFlow library in python for model fitting instead. This potentially greatly facilitates fitting JSDMs with complex model structures to large datasets in the Hmsc software.

Although the manuscript is generally well written, it contains some typos that I have attempted to outline in the detailed comments, but I generally recommend the authors to thoroughly re-read their text for potential errors that I (or another reviewer) might have missed. Generally, I find many sentences that are much less succinct than possible, and combined with the excessive use of unnecessary adjectives, the text at times feels convoluted and lacks the flow that makes for an enjoyable read.

I applaud and thank the authors for including a reproducible script of their analyses, and installation instructions for their new software package, this made trying out their implementation easier, generally more enjoyable, and trying the implementation clarified various aspects of the manuscript for me.

The selected literature in the first paragraphs is somewhat narrow, and although the article makes some mention of alternative (fast) software for JSDM fitting, it ignores large parts of the literature that were developed in recent years for fitting JSDMs. This includes the glmmTMB R-package, or the gllvm R-package whose main developer is of course at the same university as the last author of the current manuscript, but also e.g., copula-based methods (Popovic et all. (2022)), quasi-likelihod based methods (Kidzinski et al. (2022)), or the basis-function approach from Hui et al. (2023). Either how, Pichler and Hartig (2021) as a reference on L25 seems inappropriate as that reference does not speak to the “hinders of scientific discovery” due to computational limitations, but suggests a different method for fitting JSDMs based on an elastic net penalty.

There are various general statements on the benefit that this computational improvement is supposed to have on biodiversity research, e.g., “far-reaching implications for informing conservation strategies” or “a profound advancement in the domain of community ecology”. Although those might be true, since there is no comparison with other fitting methods (e.g., with the software by Pichler and Hartig (2021) that the authors cite), the reader is left wondering if this present GPU implementation is only a speed-up over the existing Hmsc software, or truly an advance for fitting JSDMs in all of community ecology as the manuscript states. Without comparison with other software implementations, it is not possible to assess the latter, and the manuscript feels like it is overselling its novelty, as it pertains a quite limited internal comparison based on a single dataset. My suggestion is that the authors tone down the language, or alternatively include a comparison with other software packages. The chosen title has a similar issue, since in the manuscript it becomes clear that there is not always a 1000 times speed-up, but only compared to the regular Hmsc implementation, and only for the single dataset with which a computational comparison has been performed.

Generally, I would appreciate some disclaimer in the text when it comes to user friendliness, as most ecologists fitting JSDMs will not be familiar with python (though it seems only a limited degree is necessary for use of HMSC-HPC), and performing a python installation, or debugging it, can be very challenging (and the vignette provided by the authors essentially states to google a problem if a user cannot figure it out, offering only very limited support even to the reviewers..fortunately I did not need any!). Out of curiosity, why did the authors decide to develop an add-on package, while keeping R as the default backend for HMSC, if use of the TensorFlow library has so much benefits?

Finally, I find the comparison based on a single dataset, and without any other software packages than that of the authors, very limiting. The authors even use a proxy for fitting Phylogenetic models as the dataset that they perform comparisons on does not actually seem to include Phylogenetic information. I advice the authors to expand on their comparison, use one or two more datasets, or just perform a complete set of simulations based on (a select few of) the various model structures that the Hmsc package is capable of fitting.

Detailed comments

Please number the manuscript throughout. The abstract and author summary were left unnumbered, leaving reviewers to manually count lines to provide comments, which is clearly not impossible, but unnecessary tedious.

Abstract

L3: “However, JSDM...” → “However, fitting or estimating JSDMs” or similar. Also, clarify what is meant here by “prohibitive”. I suppose you mean that the long computation time is prohibitive, but JSDMs in and of itself are not.

L6: Please rephrase. Your GPU implementation does not address computational limits of JSDMs generally, purely as implemented in the Hmsc software.

L9: “TensorFlow” → “the TensorFlow”

L10: “primarily targets to enable” → “enables”

L12: Please remove repeated statement from L10

L17: “boosts the scalability of Hmsc-R package” → “boosts scalability of the Hmsc R-package” and remove “reaching a significantly higher level” in the second part of the sentence

L19-L20: I will get back in my major comments about statements like these throughout the manuscript, but generally I think this is an overstatement w.r.t. the benefit of the improved method. It is great that models in Hmsc can now be fitted much faster, but there are other (potentially) faster algorithms that fit similar/the same JSDMs available, so to state that this particular GPU implementation is going to enable better informed conservation strategies, environmental management, and climate change adaptation planning, seems very unlikely.

Author summary

I somewhat take issue with the statement that the authors are “retaining the user-friendly R interface”, while later on L137-147 it becomes clear that the user actually needs to perform operations in an independent python session (albeit from R). I would like the authors to be more transparent on how their implementation requires interfacing independent use of R and python instead, as that is not a minor feat for many ecologists.

Introduction

L8: JSDMs were introduced >10 years ago, I am not sure I agree with the authors that I would call this “recent”

L13: The reference (4) cited in this sentence includes a comparison of predictive performance for JSDM fitting softwares and has little to do with fitting algorithms, which is what that this sentence is currently about. Please either 1) cite software packages or different fitting algorithms here instead, or 2) alter the sentence to target predictive performance as that is what this reference studies. Additionally, the reference is five years old and there have been many computational developments in fitting JSDMs that it does not cover.

L14: Difficult to read sentence, suggest rewriting to “HMSC facilitates researchers to study the environmental niche of species, potentially structured by additional traits and phylogenetic information” or similar.

L16: remove “regression-style” as it does not add anything to the sentence

L19: Again, I suggest changing “allows” to “facilitates” since researchers were also allowed to fit JSDMs before HMSC was developed.

L20: “post-process for prediction and inference” rarely can model results be processed for prediction and inference, since models are (should) usually be calibrated for one or the other (I have yet to meet a model that is suitable for prediction and inference). So I suggest the authors change this statement to “prediction or inference”.

L20: “Despite its utility” – please elaborate, what utility, or utility of what tool, do the authors refer here to?

L23-24: the models in HMSC can be fitted with different software, so I doubt that this statement is true. The availability of HMSC makes that these models can be fitted in a more user friendly setting, and by researchers with less knowledge of model fitting algorithms, so that it makes for generally more robust inference.

L29: “Optimizing” implies that the existing model fitting process is made more efficient, which I am not sure is the case here, because the GPU implementation actually facilitates the use of a different set of computational resources that were not previously available to the Hmsc-R user.

L37-L42: This statement may be true, although to be honest I doubt that it is. The authors do not provide an exhaustive comparison with other JSDM fitting softwares, so there is no way to verify that the software that the authors have developed actually fits these models faster than any other software currently available. And that would be a requirement for “a profound advancement in the domain of community ecology…”.

L47: “intricate” is probably not how most ecologists would describe their study designs. Perhaps “nested” or “complex” is more appropriate here.

L49: “Generalised regression” is not a method I am familiar with. Do the authors refer here to the GLM-framework?

L50: “resulted” → “resulting”

L51 “in Bayesian paradigm” → “in the Bayesian paradigm”

L52: MCMC does not make for a more versatile modeling framework than via other fitting algorithms, so please rephrase this statement.

L55: “Prediction and inference” → “Prediction or inference”, see comment w.r.t L20 where this was also stated in the same manner.

Fig 1. … “with Hmsc-R package” → “with the Hmsc-R package”. Also, throughout, please rephrase “Hmsc-R package” to “Hmsc R-package”.

Unfortunately, I could only access the figures in very low resolution as attached to the manuscript, so that they were near impossible to assess.

L75: “Inference and predictions” → “Inference or predictions”

L81: remove “prohibitive” as it does not add anything to this sentence.

L82-85: you might want to draw comparison to approximate Bayesian methods for fitting JSDMs instead of MLE here, such as Inla or empirical Bayes methods.

L88-91: This is an excellent sentence!

L93-94: “...explore what extent it can be … hardware.” → “explore to what extent it can be enhanced, when substituting the original model fitting implementation with an algorithm suited for HPC hardware” or similar. Many of the sentences in the manuscript can be made more succinct without losing information, making the whole manuscript more enjoyable to read.

L96: This sentence makes me wonder if I can use your new implementation for parallel computing with CPU instead, can the authors add something on that here? (I later read a statement on this on L143, but the point remains that the statement should be moved up in the text)

L101: remove “numerous” since this really depends on the machine/cluster that is being utilized

L102: “decomposes” is perhaps not the right word here. A more appropriate phrasing might be “Specifically, the bulk of operations within the block-Gibbs algorithm consists are algebraic in nature, so that they can be formulated within…”

L103: “These computations can be parallelized” → “The computations can then be parallelized”

L104: remove “multiple” as it is already implied. Also remove “the” before “simultaneous”

L107-108: rephrase to something like “We redesigned and re-implemented the Hmsc-R block-Gibbs sampler routine in the Python language using the …”

L127: “with TensorFlow-based” → “with the TensorFlow-based”

L154: remove “numerous” again

L188: “experimental design” → “design”. The experimental is implied by the first “experiments”

L199-201: this seems a bit odd, why do the authors not just introduce a second example dataset that actually has a Phylogeny available with it?

L224-237: I would be happy for further clarification here. Although (apparently) parallelized GPU computation is not possible for the models that use a NNGP, parallel CPU computations are still available? No speed-up compared to Hmsc routines implemented in R seems very surprising, especially as e.g., Finley et al. (2019) conclude that NNGP approximations are highly parallelizable.

References

Finley, Andrew O., et al. "Efficient algorithms for Bayesian nearest neighbor Gaussian processes." Journal of Computational and Graphical Statistics 28.2 (2019): 401-414.

Hui, Francis KC, et al. "Spatiotemporal joint species distribution modelling: A basis function approach." Methods in Ecology and Evolution 14.8 (2023): 2150-2164.

Kidzinski, L., Hui, F. K., Warton, D. I., & Hastie, T. J. (2022). Generalized Matrix Factorization: efficient algorithms for fitting generalized linear latent variable models to large data arrays. Journal of Machine Learning Research, 23(291), 1-29.

Niku, J., Brooks, W., Herliansyah, R., Hui, F. K. C., Korhonen, P., Taskinen, S., van der Veen, B., and Warton, D. I. (2024). gllvm: Generalized Linear Latent Variable Models. R package version 1.4.5.

Popovic, Gordana C., Francis KC Hui, and David I. Warton. "Fast model‐based ordination with copulas." Methods in Ecology and Evolution 13.1 (2022): 194-202.

**********

Have the authors made all data and (if applicable) computational code underlying the findings in their manuscript fully available?

The PLOS Data policy requires authors to make all data and code underlying the findings described in their manuscript fully available without restriction, with rare exception (please refer to the Data Availability Statement in the manuscript PDF file). The data and code should be provided as part of the manuscript or its supporting information, or deposited to a public repository. For example, in addition to summary statistics, the data points behind means, medians and variance measures should be available. If there are restrictions on publicly sharing data or code —e.g. participant privacy or use of data from a third party—those must be specified.

Reviewer #1: Yes

Reviewer #2: Yes

Reviewer #3: Yes

**********

PLOS authors have the option to publish the peer review history of their article (what does this mean?). If published, this will include your full peer review and any attached files.

If you choose “no”, your identity will remain anonymous but your review may still be made public.

Do you want your identity to be public for this peer review? For information about this choice, including consent withdrawal, please see our Privacy Policy.

Reviewer #1: No

Reviewer #2: No

Reviewer #3: No

Figure Files:

While revising your submission, please upload your figure files to the Preflight Analysis and Conversion Engine (PACE) digital diagnostic tool, https://pacev2.apexcovantage.com. PACE helps ensure that figures meet PLOS requirements. To use PACE, you must first register as a user. Then, login and navigate to the UPLOAD tab, where you will find detailed instructions on how to use the tool. If you encounter any issues or have any questions when using PACE, please email us at figures@plos.org.

Data Requirements:

Please note that, as a condition of publication, PLOS' data policy requires that you make available all data used to draw the conclusions outlined in your manuscript. Data must be deposited in an appropriate repository, included within the body of the manuscript, or uploaded as supporting information. This includes all numerical values that were used to generate graphs, histograms etc.. For an example in PLOS Biology see here: http://www.plosbiology.org/article/info%3Adoi%2F10.1371%2Fjournal.pbio.1001908#s5.

Reproducibility:

To enhance the reproducibility of your results, we recommend that you deposit your laboratory protocols in protocols.io, where a protocol can be assigned its own identifier (DOI) such that it can be cited independently in the future. Additionally, PLOS ONE offers an option to publish peer-reviewed clinical study protocols. Read more information on sharing protocols at https://plos.org/protocols?utm_medium=editorial-email&utm_source=authorletters&utm_campaign=protocols

10.1371/journal.pcbi.1011914.r002
Author response to Decision Letter 0
Submission Version1
18 Jun 2024

Attachment Submitted filename: rebuttal.pdf

10.1371/journal.pcbi.1011914.r003
Decision Letter 1
O'Dwyer James Section Editor
Scarpino Samuel V. Academic Editor
© 2024 O'Dwyer, Scarpino
2024
O'Dwyer, Scarpino
https://creativecommons.org/licenses/by/4.0/ This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
Submission Version1
26 Jul 2024

Dear Dr Rahman,

We are pleased to inform you that your manuscript 'Accelerating joint species distribution modelling with Hmsc-HPC by GPU porting' has been provisionally accepted for publication in PLOS Computational Biology.

Before your manuscript can be formally accepted you will need to complete some formatting changes, which you will receive in a follow up email. A member of our team will be in touch with a set of requests.

Please note that your manuscript will not be scheduled for publication until you have made the required changes, so a swift response is appreciated.

IMPORTANT: The editorial review process is now complete. PLOS will only permit corrections to spelling, formatting or significant scientific errors from this point onwards. Requests for major changes, or any which affect the scientific understanding of your work, will cause delays to the publication date of your manuscript.

Should you, your institution's press office or the journal office choose to press release your paper, you will automatically be opted out of early publication. We ask that you notify us now if you or your institution is planning to press release the article. All press must be co-ordinated with PLOS.

Thank you again for supporting Open Access publishing; we are looking forward to publishing your work in PLOS Computational Biology. 

Best regards,

Samuel V. Scarpino

Academic Editor

PLOS Computational Biology

James O'Dwyer

Section Editor

PLOS Computational Biology

***********************************************************

Reviewer's Responses to Questions

Comments to the Authors:

Please note here if the review is uploaded as an attachment.

Reviewer #1: The authors did an outstanding job responding to my comments and concerns. I appreciate the work the authors put into the revisions, and have no further comments. This will be an important contribution to the JSDM and statistical software community in the ecological sciences.

Reviewer #3: I thank the authors for a thorough revision, and have not further comments to improve their manuscript.

Reviewer #4: This is a review of the manuscript entitled "Accelerating joint species distribution modelling with Hmsc-HPC by GPU porting" which has been re-submitted for review after undergoing revisions. I'll note that this is my first review of the manuscript, I was not involved in previous review rounds. I'm basing this review off of the revised submission and response to reviewers only, I did not read the marked-up text changes from the original submission.

I think the authors did a commendable job responding to the original round of reviews. I support the author's decision to push back against conducting a large-scale comparison (having done similar levels of comparisons myself). While it would be a very useful study to conduct I feel it is beyond the scope of this paper presenting a new software implementation, would be able to stand alone as a publication of it's own, and that mixing the two would most likely result in the comparison drowning out the implementation in the paper.

Aside from a few minor edit suggestions to the figures below I have no further recommendations for the manuscript itself.

- Fig 1: The model name in 2a here is HMSC-R which is different to what you use in the manuscript: HMSC for the modelling framework and Hmsc for the software (or Hmsc R package). The hyphen notation was only used for Hmsc-HPC

- Fig 1: In the right-most red box "edges" should be capitalised

- Fig 2: A stylistic quibble that the authors can ignore if they wish, but I vastly prefer plot/axis/legend labels to start with a capital letter, and for the plot IDs to be in "A)" format. This improves readability.

I sign all reviews that aren't double blind.

David Wilkinson

The University of Melbourne

**********

Have the authors made all data and (if applicable) computational code underlying the findings in their manuscript fully available?

The PLOS Data policy requires authors to make all data and code underlying the findings described in their manuscript fully available without restriction, with rare exception (please refer to the Data Availability Statement in the manuscript PDF file). The data and code should be provided as part of the manuscript or its supporting information, or deposited to a public repository. For example, in addition to summary statistics, the data points behind means, medians and variance measures should be available. If there are restrictions on publicly sharing data or code —e.g. participant privacy or use of data from a third party—those must be specified.

Reviewer #1: Yes

Reviewer #3: Yes

Reviewer #4: Yes

**********

PLOS authors have the option to publish the peer review history of their article (what does this mean?). If published, this will include your full peer review and any attached files.

If you choose “no”, your identity will remain anonymous but your review may still be made public.

Do you want your identity to be public for this peer review? For information about this choice, including consent withdrawal, please see our Privacy Policy.

Reviewer #1: No

Reviewer #3: No

Reviewer #4: Yes: David Wilkinson

10.1371/journal.pcbi.1011914.r004
Acceptance letter
O'Dwyer James Section Editor
Scarpino Samuel V. Academic Editor
© 2024 O'Dwyer, Scarpino
2024
O'Dwyer, Scarpino
https://creativecommons.org/licenses/by/4.0/ This is an open access article distributed under the terms of the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original author and source are credited.
26 Aug 2024

PCOMPBIOL-D-24-00267R1

Accelerating joint species distribution modelling with Hmsc-HPC by GPU porting

Dear Dr Rahman,

I am pleased to inform you that your manuscript has been formally accepted for publication in PLOS Computational Biology. Your manuscript is now with our production department and you will be notified of the publication date in due course.

The corresponding author will soon be receiving a typeset proof for review, to ensure errors have not been introduced during production. Please review the PDF proof of your manuscript carefully, as this is the last chance to correct any errors. Please note that major changes, or those which affect the scientific understanding of the work, will likely cause delays to the publication date of your manuscript.

Soon after your final files are uploaded, unless you have opted out, the early version of your manuscript will be published online. The date of the early version will be your article's publication date. The final article will be published to the same URL, and all versions of the paper will be accessible to readers.

Thank you again for supporting PLOS Computational Biology and open-access publishing. We are looking forward to publishing your work!

With kind regards,

Anita Estes

PLOS Computational Biology | Carlyle House, Carlyle Road, Cambridge CB4 3DN | United Kingdom ploscompbiol@plos.org | Phone +44 (0) 1223-442824 | ploscompbiol.org | @PLOSCompBiol
==== Refs
References

1 Hartig F , Abrego N , Bush A , Chase JM , Guillera-Arroita G , Leibold MA , et al . Novel community data in ecology—properties and prospects. Trends in Ecology and Evolution. 2023;. 37949795
2 Pollock LJ , Tingley R , Morris WK , Golding N , O’Hara RB , Parris KM , et al . Understanding co-occurrence by modelling species simultaneously with a Joint Species Distribution Model (JSDM). Methods in Ecology and Evolution. 2014;5 (5 ):397–406. doi: 10.1111/2041-210X.12180
3 Warton DI , Blanchet FG , O’Hara RB , Ovaskainen O , Taskinen S , Walker SC , et al . So Many Variables: Joint Modeling in Community Ecology. Trends in Ecology and Evolution. 2015;30 (12 ):766–779. doi: 10.1016/j.tree.2015.09.007 26519235
4 Golding N , Nunn MA , Purse BV . Identifying biotic interactions which drive the spatial distribution of a mosquito community. Parasites & vectors. 2015;8 :1–10. doi: 10.1186/s13071-015-0915-1 25561160
5 Hui FKC . boral: Bayesian Ordination and Regression Analysis of Multivariate Abundance Data in R. Methods in Ecology and Evolution. 2016;7 :744–750. doi: 10.1111/2041-210X.12514
6 Clark JS , Nemergut D , Seyednasrollah B , Turner P , Zhang S . Generalized joint attribute modeling for biodiversity analysis: Median-zero, multivariate, multifarious data. Ecological Monographs. 2017;. doi: 10.1002/ecm.1241
7 Ovaskainen O , Tikhonov G , Norberg A , Guillaume Blanchet F , Duan L , Dunson D , et al . How to make more out of community data? A conceptual framework and its implementation as models and software. Ecology Letters. 2017;20 (5 ):561–576. doi: 10.1111/ele.12757 28317296
8 Niku J , Hui FKC , Taskinen S , Warton DI . gllvm—Fast analysis of multivariate abundance data with generalized linear latent variable models in R. Methods in Ecology and Evolution. 2019;10 :2173–2182. doi: 10.1111/2041-210X.13303
9 Popovic GC , Hui FKC , Warton DI . Fast model-based ordination with copulas. Methods in Ecology and Evolution. 2021;13 (1 ):194–202. doi: 10.1111/2041-210X.13733
10 Pichler M , Hartig F . A new joint species distribution model for faster and more accurate inference of species associations from big community data. Methods in Ecology and Evolution. 2021;12 (11 ):2159–2173. doi: 10.1111/2041-210X.13687
11 Doser JW , Finley AO , Kéry M , Zipkin EF . spOccupancy: An R package for single-species, multi-species, and integrated spatial occupancy models. Methods in Ecology and Evolution. 2022;13 :1670–1678. doi: 10.1111/2041-210X.13897
12 Ovaskainen O , Roy DB , Fox R , Anderson BJ . Uncovering hidden spatial structure in species communities with spatially explicit joint species distribution models. Methods in Ecology and Evolution. 2016;7 (4 ):428–436. doi: 10.1111/2041-210X.12502
13 Thorson JT , Ianelli JN , Larsen EA , Ries L , Scheuerell MD , Szuwalski C , et al . Joint dynamic species distribution models: a tool for community ordination and spatio-temporal monitoring. Global Ecology and Biogeography. 2016;25 (9 ):1144–1158. doi: 10.1111/geb.12464
14 Tikhonov G , Duan L , Abrego N , Newell G , White M , Dunson D , et al . Computationally efficient joint species distribution modeling of big spatial data. Ecology. 2020;101 (2 ):e02929. doi: 10.1002/ecy.2929 31725922
15 Hui FKC , Warton DI , Foster SD , Haak CR . Spatiotemporal joint species distribution modelling: A basis function approach. Methods in Ecology and Evolution. 2023;14 (8 ):2150–2164. doi: 10.1111/2041-210X.14184
16 Kidzinski L , Hui FK , Warton DI , Hastie TJ . Generalized Matrix Factorization: efficient algorithms for fitting generalized linear latent variable models to large data arrays. Journal of Machine Learning Research. 2022;23 (291 ):1–29. 37102181
17 Chakraborty A , Ou R , Dunson DB . Bayesian Inference on High-Dimensional Multivariate Binary Responses. Journal of the American Statistical Association. 2023; p. 1–12. doi: 10.1080/01621459.2023.2250096
18 Ovaskainen O , Abrego N , Halme P , Dunson D . Using latent variable models to identify large networks of species-to-species associations at different spatial scales. Methods in Ecology and Evolution. 2016;7 (5 ):549–555. doi: 10.1111/2041-210X.12501
19 Ovaskainen O , Abrego N . Joint Species Distribution Modelling—With Applications in R. Cambridge University Press, Cambridge, UK. 2020;.
20 Tikhonov G , Opedal ØH , Abrego N , Lehikoinen A , de Jonge MM , Oksanen J , et al . Joint species distribution modelling with the R-package Hmsc. Methods in Ecology and Evolution. 2020;11 (3 ):442–447. doi: 10.1111/2041-210X.13345 32194928
21 Norberg A , Abrego N , Blanchet FG , Adler FR , Anderson BJ , Anttila J , et al . A comprehensive evaluation of predictive performance of 33 species distribution models at species and community levels. Ecological Monographs. 2019;89 (3 ):e01370. doi: 10.1002/ecm.1370
22 Ingram M , Vukcevic D , Golding N . Multi-output Gaussian processes for species distribution modelling. Methods in Ecology and Evolution. 2020;11 (12 ):1587–1598. doi: 10.1111/2041-210X.13496
23 Abadi M, Barham P, Chen J, Chen Z, Davis A, Dean J, et al. TensorFlow: A System for Large-Scale Machine Learning. In: 12th USENIX symposium on operating systems design and implementation (OSDI 16). usenix. USENIX Association; 2016. p. 265–283.
24 Gelman A , Rubin DB . Inference from Iterative Simulation Using Multiple Sequences. Statistical Science. 1992;7 :457–472. doi: 10.1214/ss/1177011136
25 Hinsen K . A glimpse of the future of scientific programming. Computing in Science & Engineering. 2013;15 (01 ):84–88. doi: 10.1109/MCSE.2013.1
26 Terenin A , Dong S , Draper D . GPU-accelerated Gibbs sampling: a case study of the Horseshoe Probit model. Statistics and Computing. 2019;29 :301–310. doi: 10.1007/s11222-018-9809-3
27 Abadi M , Isard M , Murray DG . A computational model for TensorFlow: an introduction. In: Proceedings of the 1st ACM SIGPLAN International Workshop on Machine Learning and Programming Languages. ACM. ACM; 2017. p. 1–7.
28 GBIF Backbone Taxonomy. Checklist dataset; 2021. https://registry.opendata.aws/gbif. Available from: https://registry.opendata.aws/gbif.
29 Banerjee S , Gelfand AE , Finley AO , Sang H . Gaussian predictive process models for large spatial data sets. Journal of the Royal Statistical Society Series B: Statistical Methodology. 2008;70 (4 ):825–848. doi: 10.1111/j.1467-9868.2008.00663.x 19750209
30 Datta A , Banerjee S , Finley AO , Gelfand AE . Hierarchical nearest-neighbor Gaussian process models for large geostatistical datasets. Journal of the American Statistical Association. 2016;111 (514 ):800–812. doi: 10.1080/01621459.2015.1044091 29720777
31 Finley AO , Datta A , Cook BD , Morton DC , Andersen HE , Banerjee S . Efficient algorithms for Bayesian nearest neighbor Gaussian processes. Journal of Computational and Graphical Statistics. 2019;28 (2 ):401–414. doi: 10.1080/10618600.2018.1537924 31543693
32 Quiroz ZC , Prates MO , Dey DK , Rue Hå . Fast Bayesian inference of block Nearest Neighbor Gaussian models for large data. Statistics and Computing. 2023;33 (2 ):54. doi: 10.1007/s11222-023-10227-1
33 Peruzzi M , Banerjee S , Finley AO . Highly scalable Bayesian geostatistical modeling via meshed Gaussian processes on partitioned domains. Journal of the American Statistical Association. 2022;117 (538 ):969–982. doi: 10.1080/01621459.2020.1833889 35935897
34 Mingas G, Rahman F, Bouganis CS. On optimizing the arithmetic precision of MCMC algorithms. In: 2013 IEEE 21st Annual International Symposium on Field-Programmable Custom Computing Machines. IEEE; 2013. p. 181–188.
35 Neal RM . MCMC using Hamiltonian dynamics. In: Handbook of Markov Chain Monte Carlo. Chapman and Hall/CRC; 2011.Available from: 10.1201/b10905.
36 Duan LL , Johndrow JE , Dunson DB . Scaling up Data Augmentation MCMC via Calibration. Journal of Machine Learning Research. 2018;19 (64 ):1–34.
