Abstract
A novel perturbative Monte Carlo mixed quantum mechanics (QM)/molecular mechanics (MM) approach has been recently developed to simulate molecular systems in complex environments. However, the required accuracy to efficiently simulate such complex molecular systems is usually granted at the cost of long executing times. To alleviate this problem, a new parallelization strategy of multi-level Monte Carlo molecular simulations is herein proposed for heterogeneous systems. It simultaneously exploits fine-grained (at the data level), coarse-grained (at the Markov chain level) and task-grained (pure QM, pure MM and QM/MM procedures) parallelism to ensure an efficient execution in heterogeneous systems composed of central processing units and multiple and possibly different graphical processing units. This is achieved by making use of the OpenCL library, together with appropriate dynamic load balancing schemes. From the conducted evaluation with real benchmarking data, a speed-up of 56x in the computational bottleneck part was observed, which results in a global speed-up of 38x for the whole simulation, reducing the time of a typical simulation from 80 hours to only 2 hours.
Keywords
1 Introduction
Computer simulations have become standard tools in chemical research, allowing for the prediction and characterization of complex molecular structures. Advances in this field are not only due to improvements of physical models, but also to improvements in computing systems, which substantially reduce the computational time. Today, thousands of compounds can be screened in a matter of minutes for compatibility and possible activity. This plays a crucial role in drug design (Geromichalos, 2007), to which thousands of lives are tied.
Molecular simulations are commonly based on molecular dynamics (MD) or on the Monte Carlo (MC) method. MD simulates the system by calculating the forces acting on each atom, applying classical mechanics to evolve the system in time. MD allows the study of a wide range of dynamical properties, such as the conformational landscape of a molecule. However, usable results can only be obtained by using very small time steps (in the order of a femtosecond), which limits the system simulation to the order of microseconds. Conversely, the Metropolis MC method (Metropolis et al., 1953) samples the system in the ensemble space, rather than following a time coordinate. With this method, a sequence of random configurations is obtained on the basis of Maxwell-Boltzmann statistics, by performing random movements at each frame and by evaluating the corresponding change of the system energy. The resulting set is then analyzed from the perspective of the specific thermodynamic property under consideration. Even though MC does not enable the computation of dynamical quantities, it allows the study of processes with longer timescales, for which sampling in time would be infeasible.
Accordingly, the underlying method for calculating the energy of a given molecular structure can vary depending on the system and the properties under study. The choice can fall to traditional molecular mechanics (MM), quantum mechanics (QM) or mixed QM/MM methods. MM approaches represent atoms and molecules through ball and spring models, with heavily parameterized functions to describe their interactions. However, such an approach may lead to several limitations. For example, atomic bonds have to be kept throughout each simulation, thus preventing the chemical reaction being modeled in a single run. Alternatively, QM approaches explicitly simulate the electrons, at a cost of a much higher computational burden, as they involve obtaining approximate solutions to the Schrödinger equation. Furthermore, the computation cost of most QM methods scales exponentially with the system size, thus impeding the modeling of more complex structures. An alternative solution consists of a mixed QM/MM approach, which combines the strengths of each method. In this case, a small active region is simulated with QM, while the remaining environment is represented by classical MM. Nevertheless, the combination of the mixed QM/MM terms with the pure QM and MM terms that co-exist in this approach usually result in a very computationally diverse algorithm containing both heavy single-threaded code and several opportunities to exploit task and data parallelism.
In this context, the perturbative Monte Carlo (PMC) mixed QM/MM method, first suggested by Truong and Stefanovich (1996), was presented as a promising approach to mixed QM/MM calculations. In this method, the coupling between QM and MM is approximated by using perturbation theory, leading to 2-body interaction energy terms. However, the algorithm has to be designed to take full advantage of this separation, and no efficient implementation was ever put forward.
In this work, a multi-device parallel approach to PMC is proposed, by using Metropolis MC sampling and a mixed QM/MM method for the energy calculation. In the presented solution, the QM/MM part of the PMC algorithm (henceforth referred to as the PMC cycle) is accelerated using OpenCL. The QM part (henceforth referred to as the QM update) invokes the widely used MOLPRO (Werner et al., 2012) program package, and it is accelerated by exploiting multiple central processing unit (CPU) cores to run several independent state-space Markov chains. The proposed solution is both versatile and scalable, enabling researchers to combine different generations of computing platforms, accompanying the growing tendency of heterogeneous computational clusters. Accordingly, the main contributions of this work are the following.
First parallel heterogeneous solution for the perturbative Monte Carlo QM/MM method.
Acceleration procedure based on the simultaneous exploitation of fine-grained (at the data level), course-grained (at the Markov chain level) and task-grained (pure QM, pure MM and QM/MM procedures) parallelism to achieve a scalable solution for heterogeneous platforms.
Integration of a performance-aware scheduling algorithm in the parallel PMC simulation to enable the full and balanced exploitation of the computing power of all the different devices in a given heterogeneous platform.
Study and evaluation of other acceleration and energy saving opportunities based on the adaptation of the numerical precision used by the algorithm when considering either double or single-precision floating-point or fixed-point representations. Such a study was integrated in the conducted performance and power analysis.
Hence, by properly parameterizing the kernels, the same OpenCL solution may be efficiently run in very different platforms (e.g. CPUs, graphical processing units (GPUs), CPUs+GPUs, etc.), where each of these platforms may constitute an individual processing node of a scalable multi-node processing infrastructure, e.g. CPU/GPU computational cluster managed either using MPI or OpenCL (Kim et al., 2012). In particular, the considered proof-of-principle implementation that is herein presented is focused on tackling the existing parallelization challenges and on demonstrating and evaluating the performance advantages of the proposed CPU+GPU parallelization. In accordance with this, it considers a single processing node equipped with a (AVX2 enabled) quad-core Intel i7-4770K CPU and several different GPU accelerators, from NVIDIA and AMD.
By considering the execution on a single CPU core as a steady baseline reference, it is shown that a speed-up of about
The rest of this paper is organized as follows: Section 2 provides a brief background on the PMC QM/MM algorithm. Section 3 discusses the existing parallelization opportunities and presents the proposed parallel solution. Furthermore, a dynamic load balancing for multiple heterogeneous accelerators is presented, as well as an approach to sample the MC state-space in parallel using multiple CPU cores. Section 4 describes the benchmarking setup and presents the timing and the speed-up results for the simulation bottleneck (PMC cycle) and the complete PMC QM/MM run, when running single and multiple Markov chains. In Section 5, a study about the impact of using mixed precision (single and double precision floating-point, as well as fixed-point) on the execution time and power consumption of the bottleneck procedure is presented. Finally, related work is discussed in Section 6.
2 Perturbative Monte Carlo QM/MM
The present paper is focused on the computational aspects of the PMC algorithm, with a particular emphasis on the acceleration and use of hybrid computing nodes. Nevertheless, a brief characterization of the QM/MM simulations under study, together with an overview of the PMC method, is herein presented.
The perturbative Monte Carlo QM/MM algorithm is a molecular simulation procedure designed to study mixed QM/MM simulations. These interactions usually consider a circumscribed region of interest and an immersive environment. For the purpose of describing the PMC method, a chemical solution composed of a solute (region of interest) and a solvent (environment) will be herein considered as an example. Accordingly, Figure 1 depicts such a system, comprised of a single solute molecule (molecule C), which is treated at the QM level, and two solvent molecules (molecules A and B), treated at the MM level. Then, by applying a Metropolis MC step, one of these molecules will be randomly picked, translated and rotated to generate a new structure. This last MC step will be either accepted or rejected, according to the resulting energy change. This energy change is computed by considering two types of interactions with the displaced molecule (e.g. molecule A), resulting in both QM/MM energy terms or pure MM terms. The QM/MM terms account for the interaction with the QM solute (molecule C), whereas the MM energy terms account for the interaction with every other solvent molecule (in this case, just molecule B). Furthermore, for both levels of theory (QM/MM or pure MM), Coulomb and van der Waals (vdW) contributions have to be considered.

A system composed of one solute molecule (C) and two solvent molecules (A and B). For each MC step, the difference in terms of the energy between the displaced molecule (A) and every other molecule has to be computed, but at different levels of theory.
Figure 2 illustrates the dataflow corresponding to the considered PMC method. In each iteration, the PMC cycle comprehends K Monte Carlo steps of the MM subsystem, while keeping the QM region static. In another process, the electronic density of the QM region is updated (QM update) by using MOLPRO, and the result is subsequently used in the next PMC cycle. As described earlier, the system energy variation has to be computed at each MC step (henceforth referred to as a PMC cycle step), given by
where each

Perturbative Monte Carlo QM/MM method. Time footprint for a single PMC cycle step when processing bench-A dataset (see Section 4) running on one core of the Intel i7-4770K CPU (AVX2 enabled).
Figure 2 also includes a profiling evaluation executed on a single-core of an Intel i7-4770K CPU with vector instructions enabled (AVX2), when processing the bench-A input dataset (see Section 4 for additional details). Figure 3 complements this information by presenting the overall execution results for a few PMC iterations, whereas Figure 2 depicts a more detailed overview of each step of the simulation bottleneck. The Coulomb grid QM/MM procedure (
affecting each term differently, depending on the distance between each {atom, grid point} pair (r), and completely disregarding the interaction (set to 0) whenever

Four complete PMC iterations, each one comprised of a QM update and 4k PMC cycles (see Figure 2) for bench-A dataset (see Section 4), running on one single core of the Intel i7-4770K CPU (AVX2 enabled). The bottleneck of each PMC iteration is the PMC cycle.
3 PMC cycle parallelization
3.1 Considered parallelization models
When looking at the diversity of computational platforms that are commonly available today, two distinct QM/MM simulation cases deserve particular attention: running fewer Markov chains than the number of available OpenCL accelerators, and the opposite case. While the former is typically found in multi-node computational clusters, requiring the use of specially tailored communication-aware load balancing approaches (Li and Lan, 2005; Meng et al., 2010; Zheng et al., 2010), the latter is more common in single node systems. In this subsection, the available parallelism of both simulationenvironments is analyzed, by focusing on the simultaneous exploitation of multiple levels of parallelism, in order to achieve a scalable solution for heterogeneous platforms.
The MC state-space can be sampled by running several Markov chains in parallel, allowing the simultaneous execution of the respective PMC cycles. Furthermore, this technique also allows execution of the QM update process for several chains in parallel, by using the available CPU cores. This execution layout is shown in Figure 4. Although the depicted example corresponds to three independent chains, this number can scale with the available computational resources. Moreover, to minimize the execution time, more OpenCL accelerators can be added to the system, by running more chains in parallel. Accordingly, the number of independent chains n that should be spawned in parallel in order to minimize the average per-chain execution time is dependent on: (i) the time taken for one CPU core to perform a chain QM update (

MC state-space alongside with the execution timeline for three Markov chains.
On the other hand, the PMC cycle offers many opportunities for data and task-level parallelism. Figure 5 (left) shows the data dependencies of each process in the PMC cycle. In particular, the data structure corresponding to the changed molecule (chmol) is written by the Monte Carlo step and it is subsequently read by all the energy calculation procedures, which compute their respective

Data dependencies within the PMC cycle (left), together with a mapping of the PMC cycle procedures to OpenCL kernels (right). Kernels marked with a
3.2 OpenCL kernels for the PMC cycle
The implemented OpenCL kernels for the PMC cycle are listed and mapped to the corresponding procedures in Figure 5 (right). The amount of parallelism that can be extracted within each kernel varies according to existing data dependencies and the amount of input data. Accordingly, it is highest in the q3m_c kernel, not only because the Coulomb QM/MM energy interaction is highly data-parallel (as can be observed by analyzing Algorithm 1), but also due to the size of the grid it takes as input, which may vary from hundreds of thousands to millions of grid points. This data set remains resident in the accelerator’s memory between PMC cycle steps.
A diagram of the q3m_c and q3m_finish kernels is presented in Figure 6. Firstly, each work-item loads P grid points and the A atoms that comprise the chmol molecule from the global memory. The latter corresponds to a global memory broadcast, whereas the former is performed by P coalesced global memory read instructions, each reading a contiguous stripe of grid points to the work-group (step 1, in Figure 6). Then, for each {atom, grid point} pair, the corresponding work-item computes the squared Cartesian distance (within a periodic box) and compares it with squared cutoffs, thus avoiding an expensive sqrt operation. Depending on the resulting distance, the corresponding energy expression is computed (see the cutoff branches in Algorithm 1) and the results are accumulated in private memory (step 2). After this, the work-items of the same work-group reduce the computed energies in their local memory, by accumulating all terms in one single memory address after

q3m_c and q3m_finish kernels structure. In this example, work-group 0 was presented with additional detail, although all work-groups share an identical structure. Likewise, the 8 work-items per work-group configuration was adopted for simpler illustrative purposes, as the work-group size is fully parametrizable.
Hence, by including a first set of energy reductions in the same kernel as the
The mm_vdwc and q3m_vdwc kernels have a fairly similar structure, except for the involved data and the considered energy expression. The former accounts for the Coulomb and vdW interactions between the chmol and the lattice, whereas the latter accounts for the interaction between the chmol and the QM atomic nuclei.
3.3 Exploiting multiple OpenCL devices
Figure 7 illustrates the described parallelization approach for a generic heterogeneous system composed of a host CPU and N different OpenCL devices. In this approach, the host is responsible for syncing the operations between the OpenCL devices, which share partial energy results on every iteration. In this particular example, device 0 is running all kernels, although q3m_c and q3m_finish only compute part of

Exploiting multiple heterogeneous OpenCL devices to execute the PMC cycle. The execution is balanced by running different kernels on each device and dividing the work of the heavier kernels (q3m_c and q3m_finish).
The overhead introduced by the device synchronization, to be executed at every step, is caused by several factors. Firstly, to read and write the partial energies of each device, one has to call the OpenCL functions enqueueReadBuffer and enqueueWriteBuffer, which also include an implicit clFinish statement to wait for the previous kernels in that step to finish (launches are chained using OpenCL events). This is accounted for in the R/W Launches block, in Figure 7. Secondly, each memory transfer introduces a small overhead corresponding to a copy of one floating point number per reduced energy term. Finally, syncing the host-side threads that are managing the OpenCL accelerators (Barrier Sync) and launching and parameterizing the OpenCL kernels (Launch overhead) also introduces some overhead.
3.4 Load balancing
To account for the possible heterogeneity of the computational platform, load balancing techniques were conveniently devised to distribute the computation of the system energy among the available OpenCL accelerators. In this respect, several strategies could be employed, including task-level approaches to distribute the computation of the several energy terms among the co-existing accelerators, data-level approaches to distribute the computation of each individual energy term, or mixed approaches. However, given the substantial difference between the computational cost of the Coulomb grid QM/MM energy term (
The amount of grid data that is assigned to each device on each iteration is chosen according to a dynamic load balancing algorithm (adapted from Clarke et al. (2011)), by using performance information from previous iterations to balance the load. To accomplish this, the 3D grid is divided into n small and independent grid blocks. In the first step, all p devices are assigned the same number of blocks
Let
If
Recompute the amount of assigned grid blocks:
At this point, it is important to recall (see Section 2) that different cutoff regions may result in different energy expressions (or no energy computation at all). Consequently, the accelerators might compute over grid partitions that fall into different cutoff regions, thus having different computational efforts. Hence, the execution time measurements should be computed by averaging the execution time in several previous iterations, in order to avoid any misclassification of device performance.
The described algorithm is run by the host once every N iterations, after the Barrier Sync (see Figure 7). To accomplish this, the performance measurements of each device are shared between the corresponding host-threads, via host shared-memory.
4 Performance evaluation
4.1 Benchmarking setup
To experimentally evaluate the proposed parallelization approach, two sets of benchmarks were run on several hardware configurations. The first set includes benchmarks bench-A, bench-B and bench-C (see Table 1), which represent typical QM/MM setups and can therefore be used to assess the performance of the most demanding simulation (i.e. the PMC cycle), by running 10k steps. The QM part of these benchmarks consists of a set of protonated arginines that are acylated at the N-terminus and methylaminated at the C-terminus. This amino acid was solvated in a periodic water box (MM part), containing a variable number of water molecules (depending on the considered benchmark). The grid for the electronic charge density description was constructed by following Mura and Knowles (
Considered QM/MM benchmark datasets. The chemical aspects of bench-R are presented in detail in Claeyssens et al. (2011).
Bench-R consists of a smaller simulation box, designed for a much longer and realistic run. This simulation corresponds to the chorismate molecule in solution. Its conversion to prephenate is a widely studied biochemical reaction, as the same mechanism is followed in solution and in the chorismate mutase enzyme. The chemical aspects of this reaction are described in Claeyssens et al. (2011). For this benchmark, the run is comprised of 24.8 million steps, with the QM update executed every 50k steps (totaling 496 PMC outer iterations).
The considered hardware for the experimental setup is listed in Table 2. Different work-group partitioning schemes were used for each device. For NVIDIA GPUs, the CUDA calculator proved to be a useful tool for choosing starting point parameters. For AMD cards and Intel CPUs, the optimal values were found through test and experimentation, resulting in small multiples (e.g. 1 to 4) of the preferred elementary work-group size returned by an OpenCL device discovery query, made in runtime to the underlying platform.
Computational platforms considered in the experimental evaluation.
Most of the presented performance comparisons are relative to the baseline version of the code executed on a single core of the i7-4770K processor, compiled with Intel compiler (ICC v13.1.3) with flag-fast, such as to use AVX2 instructions on all mA platforms and AVX instructions in the remaining platforms. Furthermore, since the CPU with higher performance is installed in platform mA
4.2 PMC cycle acceleration
Table 3 presents the PMC cycle execution time (10k steps) obtained for benchmarks bench-A, bench-B and bench-C, when profiled for several hardware configurations. The overall execution time corresponds to the cost of running 10k steps, plus the final output flushing from the OpenCL device(s) to the host, and file writing (Output time in Table 3, ranging from ∼0.5 s to ∼2 s). The extra overheads related to the OpenCL initialization time and the input file reading were not accounted for, because they do not scale with the simulation size and would be diluted in longer runs (contrary to output generation).
Total execution time (
The difference between the execution times of bench-A and bench-B corresponds to the number of MM molecules. This introduces two implications, namely, bench-B imposes a heavier footprint of the mm_vdwc and mm_finish kernels, and an increased size of the generated output, which in turn means a heavier decide kernel and a longer output flushing. The latter can be observed in Table 3 and mainly depends on the host-to-device communication speed to read the output, and on the time to write the output file.
On the other hand, bench-C has a larger QM part, resulting in heavier q3m_c and q3m_finish kernels. This favors the overall performance with respect to bench-B, as the performance of the most data-parallel kernels is favored by a higher number of grid points. The speed-up results of the parallel platforms with respect to the mA

Speed-up obtained for a PMC cycle with 10k iterations, when using
According to the presented results, the speed-up values in the PMC cycle acceleration are fairly high when compared to mA
Table 4 presents the kernel execution times for the particular case of the GTX780Ti accelerator, together with the times corresponding to the reference implementation in the mA
Kernel execution times in platform mA
4.2.1 PMC cycle load balancing
Figure 9 presents the kernel timing results per PMC cycle step, when considering bench-A executing on the mA

OpenCL kernel timings (per step) for the PMC cycle on the mA

Convergence pattern of the implemented load balancing algorithm (balancing every 2000 steps), for Bench-C running on the platform mA
4.2.2 PMC cycle scalability
The memory footprint of the PMC cycle kernels in the OpenCL accelerators is mainly limited by the program output buffers, the pre-generated random lists required for the monte_carlo kernel, the MM lattice and the QM grid. The first two solely depend on the number of executed steps, and are addressed by having the host CPU flushing the output and refreshing the random lists periodically. The second two were also not a problem for the selected benchmarks, since the largest used QM grid and MM lattice occupy
Scheduling the computations belonging to a single Markov chain among multiple GPUs comes with an additional overhead of syncing the PMC cycle step results among the involved devices, at the end of every step. Fortunately, these overheads do not scale with the simulation size, since the buffers that need to be synced back and forth (between the host and the accelerators) are reduced energy terms, each represented by a single number. For the particular example presented in Figure 9, each device has to read/write three reduced terms per step, which has a performance impact of a few dozen microseconds. Conversely, the computational cost of the q3m_c/reduce kernels scales with the size of the QM grid, meaning that multi-device scalability is better for larger grids (which concern the most computationally challenging problems).
Figure 11 presents the obtained speed-ups for the PMC cycle kernels acceleration, when a second GPU is added to platform mC

Scalability of the PMC cycle on platform mC when changing the size of the QM part in bench-A. Speed-up results are presented for a dual GTX680 system with respect to a single GTX680.
4.3 Global PMC results
To conclude this evaluation of the proposed parallel solution, the execution of the complete PMC simulation is assessed (including the QM update and the PMC cycle stages). For such a purpose, a greater focus will be given to bench-R, corresponding to the longest and more realistic dataset. Figure 12 depicts the simulation results, showing the conversion of the chorismate structure into prephenate.

QM/MM Simulation box for the bench-R dataset (partial representation), together with the simulation results for the conversion of the chorismate structure into prephenate.
Table 5 presents the execution times for the inner PMC cycle (comprising 50k steps), the QM update and the full PMC application (comprising 496 PMC outer iterations, which yields a total of 24.8 M PMC cycle steps). This performance study was conducted with the mC
bench-R execution time for the PMC cycle (50k steps) and QM update (24.8M iters) stages, as well as for the full PMC simulation.
bench-R execution time and speed-up when comparing the baseline mC
When considering all these configurations, it is observed that the execution time of the full bench-R for the mC
For the multiple Markov chain case, the attained speed-up is mainly due to the parallel MC state-space exploration. In fact, by comparing the single with the multiple chain speed-up values for the same precision approach, a scalable speed-up trend can be observed from the obtained results. For example, by comparing the speed-ups attained in the mC
Among the presented results, the most conservative speed-up (
5 Numerical evaluation: Convergence accuracy and energy consumption
The proposed parallel implementation does not make any approximation or relaxation with respect to the original sequential method, yielding exactly the same output. Moreover, besides the original 64bit floating-point representation (
The resulting performance gains, for each of the considered precisions when executing the q3m_c kernel, are presented in Table 7. Depending on the adopted GPU device, execution speed-ups as high as
Speed-up of the mixed precision q3m_c kernel versions versus the original
Obtained numerical precision for the
In order to further assess the impact of the considered mixed precision solutions, the average energy consumption was measured on the NVIDIA Tesla K20C GPU, by using the NVML library. The method presented in Guerreiro et al. (2015) was used to gather the attained power measurements, by using the maximum allowed sampling frequency of
Execution time, speed-up, energy savings and average power consumption when running all the devised numerical precision approaches. The testbench was run for 100k steps, in order to ensure a representative sampling of the computational cost of the OpenCL accelerated q3m_c kernel. The default core frequency configuration was used for all experiments.
Energy savings versus corresponding
The first aspect worth noting refers to the configuration that presented the highest average power: the
6 Related work
Similar research on molecular simulation acceleration that is found in the literature is typically classified in terms of: i) the nature of the employed sampling; ii) the theory used for the energy calculations; and iii) the chemical application for which they have been tuned. The employed sampling is usually performed in time (MD) or in state-space (MC) and the energy interactions may consider pure QM, pure MM and mixed QM/MM terms. Finally, the application for which the algorithm has been tuned to may vary greatly, and this is the main reason why the attained performance gains in the parallelization of these algorithms can seldom be compared to each other.
Although computationally demanding, MD is a popular approach to study a wide range of dynamical properties. Hence, several approaches were proposed for its acceleration, dating from the earlier times of GPGPU (Stone et al., 2007; Friedrichs et al., 2009) to more recent publications (Pratas et al., 2012; Mashimo et al., 2013; Nitsche et al., 2014). On the other hand, methods based on MC sampling allow simulating systems with longer timescales, and several works have also accelerated these algorithms with GPGPU (Anderson et al., 2007; Uejima et al., 2011; Anderson et al., 2013; Lutsyshyn, 2013; Hall et al., 2014). Since our work falls into the latter category (MC), a more detailed review of such works is presented.
In particular, Anderson et al. (2007) propose a GPGPU solution for quantum Monte Carlo (QMC), achieving up to
On the other hand, Uejima et al. (2011) use MC sampling (based on variational Monte Carlo) and target QM/MM systems. Just like the algorithm described in this work, the bottleneck arises in the computation of the electrostatic potential. They target computational clusters composed of GPUs to handle the bottleneck code and CPUs for the remaining procedures, obtaining a speed-up of up to
Anderson et al. (2013) describe a CUDA GPGPU implementation for many-particle simulations using MC sampling. They partition the particle set in several cells and apply many MC steps in parallel, known to not interfere with each other. They do not target QM/MM systems. Instead, tests are performed for a ‘hard disk’ system (two-dimensional particles which cannot overlap), and the considered particle interactions are the physical collisions. Unlike physical collisions, the electrostatic potentials considered in our work have a much higher range, and as such the computed energy terms at each MC step depend on a much larger number of their neighbor molecules (the potential cutoffs are about half of the simulation box). Hence, such a scheme would not effectively solve the problem that is herein considered, as most MC steps would interfere with each other. The work presented in Hall et al. (2014) also describes a parallel approach to particle MC simulations using CUDA, without any emphasis on QM/MM systems.
Finally, the work by Nitsche et al. (2014) targets QM/MM simulations, although time sampling (MD) is used instead, and a special focus is given to accelerating the QM grid generation, achieving up to
Also, it is worth recalling that direct performance comparisons are difficult to handle in this field, and very few authors do it in the literature. Furthermore, very few have considered the use of heterogeneous architectures for hybrid QM/MM simulations, whilst using MC sampling. The proposed solution efficiently takes advantage of the hybrid nature of QM/MM simulations and the MC state-space exploration, unlike typical pure QM or MM approaches.
Finally, it is worth noting that most existing works adopted CUDA as the programming framework, being constrained to NVIDIA GPUs. To circumvent this limitation, other frameworks have been developed to ease the programming of non-conventional architectures, such as StarPU (Augonnet et al., 2011) and OpenCL. Due to its simpler means to orchestrate multiple devices in an heterogeneous environment and to write portable code between different architectures, the latter was used in this work. Moreover, by allowing an easy extension with the MPI framework (e.g. SnuCL by Kim et al. (2012) extends the original OpenCL semantics to a CPU/GPU cluster environment, without any required modifications in the original OpenCL program), the proposed approach opens the possibility of attaining further performance scalability at the chain-level, since the most challenging fine-grained part consisting of the parallelization of the PMC cycle was already overcome.
7 Conclusions
An OpenCL implementation of a novel QM/MM Monte Carlo model was presented, specially geared towards chemical simulations in the condensed phase. It was shown that the use of a hybrid parallel architecture makes particular sense in this context, as one can exploit both the inherent parallelism in the interaction between the MM and QM systems, and the task and data parallelism available in the involved computations. Concurrently to the OpenCL accelerators, the host CPU manages workload distribution in order to ensure a dynamic load balancing, and executes the QM grid update.
The devised solution proved to be particularly well suited for heterogeneous systems. Since pure QM codes are not as amenable to parallelism as force field calculations, the QM update is especially fit for execution on host CPU, allowing the more time-consuming PMC cycle to be executed on the OpenCL accelerators. It was also verified that the efficiency and scalability of the proposed solution on several different heterogeneous platforms is composed of multi-core CPUs and multiple and very different GPUs. As a result, by exploiting the massively parallel GPU architecture, the computational bottleneck in the original single-core approach was accelerated by
Footnotes
Declaration of conflicting interests
The author(s) declared the following potential conflicts of interest with respect to the research, authorship, and/or publication of this article: This project has been partly supported by the DFG within the SFB 1073 (project C03).
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This work was partially supported by national funds through Fundação para a Ciência e a Tecnologia (FCT), under projects Threads (ref. PTDC/EEA-ELC/117329/2010), P2HCS (ref. PTDC/EEI-ELC/3152/2012) and project UID/CEC/50021/2013.
