using the EMAN2 CUDA api

EMAN2 includes support for CUDA processing. To use CUDA in EMAN2 you must set the flag ENABLE_EMAN2_CUDA using ccmake, then recompile. This step defines the identifier ENABLE_EMAN2_CUDA causing the preprocessor to demarcate CUDA code for compilation. Any new CUDA code should be enclosed by #ifdef ENABLE_EMAN2_CUDA, #endif directives to restrict its complication. Compiling with CUDA exposes addition methods and members of the class EMData. Below is a list of addition EMData methods with python bindings.

If you are writing new C++ code, you will have access to and want to use these additional EMData CUDA methods:

In addition to the above functions, the following methods are used internally to implement the CUDA memory management scheme, which uses a least frequently used algorithm. When an EMData object data array is copied to the GPU it goes on top of a static linked list(there is only one linked list whose beginning and ending pointers are static). Additional items moved to the GPU go on the top of the list. When an item is accessed it is moved to the top of the list. If GPU memory runs out items are removed from the bottom of the linked list. These items will be the ones least frequently used, as EMData objects filter down to the bottom. The following methods implement this memory management scheme. Both global and texture memory is mamaged (the concept of texture memory makes more sense for openGL programmers).

Writing CUDA for EMAN2 programs

CUDA code for EMAN2 is located in libEM/cuda. Please review this code for examples on CUDA programming in EMAN2./ I also recommend reading programming massively parallel processors if you are unfamiliar with CUDA. As of now, only 3D processing is CUDA enabled. This includes 3D aligners, Fourier reconstruction algorithms, and projection algorithms. Please review this code for EMAN2 cuda examples.

Eman2UsingCudaFromC++ (last edited 2012-05-01 22:00:50 by JohnFlanagan)