Purpose: Monte Carlo (MC) code’s running times are significantly reduced with the development of general-purpose graphic processing unit (GPGPU) based algorithms. However, some calculations, like dose influence matrix (Dᵢⱼ) calculation or temporal dose calculation, cannot take full advantage of the GPGPU due to the limited memory size and the expensive computational cost of memory transfer. We developed a memory-efficient framework to fully utilize GPGPU within our novel GPU-based MC code for proton therapy, “moqui”.Materials and
Methods: To increase the efficiency of the code, we have adopted the hash table, one of the key-value pair data structures, to the scoring system of our MC code. We put the voxel index in the key and accumulated the voxel’s dose deposition in the value. There are two advantages of using the hash table. (1) Only voxels that interact with particles occupy the memory (2) A hash function of a key determines the address of a pair, thus reducing the time for searching over the data structure to check a pair’s existence and the existing pair’s address. To demonstrate the efficiency of the developed code, we calculated the Dᵢⱼ matrix and compared with an array scoring system, which is a conventional data structure used for scoring.
Results: For simulating 40 million particles, the hash table scoring system took about 115.9 seconds, while the array scoring system took 151.4 seconds. With the hash table scoring system, we can score every voxel that interacts with particles. In contrast, the array scoring system was only able to score selected voxels using twice of the memory used for the hash table scoring system.
Conclusion: The MC code with the hash table scoring system runs faster and has better memory-efficiency than the conventional scoring system. It is incorporated in the “MOnte carlo for QUIck proton dose calculation” (moqui).
Funding Support, Disclosures, and Conflict of Interest: This study is supported by NCI R01 234210 (Fast Individualized Delivery Adaptation in Proton Therapy)