How to use Cuda Compiler

It is not possible to just “use nvcc” to compile the massive Geant4 code base into a fully functional integrated GPU enabled of Geant4.

Geant4 is a multi-purpose highly modular single threaded CPU application which is written in C++. Because it is meant to be very versatile this makes GPU acceleration difficult, as it is thousands of lines of very complicated object-oriented code which was written by many engineers over the course of 15 years.

Currently I am working on a Geant4 project which will enable GPU acceleration for x-ray simulations only, and I am basically writing a plug-in from scratch which will be called from the main application.

Also keep in mind that any Monte Carlo simulation will consist of very complex code, particularly related to how to represent the geometry and detectors. All Geant4 GPU work I am aware of to date uses a voxelized representation of the “world”. Also secondary particle generation is tricky in a parallel architecture, so whoever will be handling this in your group should have a great deal of experience with CUDA programming.

So basically I am saying that this is a much bigger project than you think, and you will need much time and experience (with CUDA and C programming not high-level physics) to complete.

The performance gain will be significant, but nothing this ambitious will be easy, free or quick.

1 Like