StreamHPC / gromacs

OpenCL porting of the GROMACS molecular simulation toolkit
http://www.gromacs.org
Other
25 stars 4 forks source link

Handling OpenCL source files #3

Closed ancahamuraru closed 9 years ago

ancahamuraru commented 10 years ago

Improve the way OpenCL code is loaded and built. Consider the following:

dkarkoulis commented 10 years ago

Hi Anca,

I got a fix for the OpenCL kernel source. I added a rule in the CMake to install the OpenCL source files along with Gromacs:

... -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/include/gromacs/version.h -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/lib/x86_64-linux-gnu/libgromacs.a -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/lib/x86_64-linux-gnu/pkgconfig/libgromacs.pc -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/bin/opencl/nbnxn_ocl_kernels.cl -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/bin/opencl/nbnxn_ocl_kernel_utils.clh -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/bin/opencl/nbnxn_ocl_kernels.clh -- Installing: /home/dimitris/HPC/gromacs-mine/bin_dbg/bin/opencl/nbnxn_ocl_kernel_nvidia.clh ...

The rule is active only for development builds. Anyway, currently if you just move the gromacs installation folder the OpenCL part will break! As you suggested for the release builds there are two possibilities: 1) Embedding the kernels in a header as a string via a script or a hexdump 2) Get the kernel files from the known relative path to the executable

First should be more robust, second is simpler.

dkarkoulis commented 10 years ago

I have pushed the changes that implement (2) in the dk branch. If you are not running from the installation folder you can set the OCL_FILE_PATH environment variable to point to the full path of the kernel (same way as you were defining it in the source until now)

ancahamuraru commented 9 years ago

Tested the approach with OCL_FILE_PATH environment variable - worked ok.

sharpneli commented 9 years ago

The OCL_FILE_PATH has been changed so that it now describes the location of the source directory. Previously it searched for the kernel using this but still searched for include files using relative paths.

ancahamuraru commented 9 years ago

The path for the main OpenCL file is determined

Further on, this path is used to generate the include paths needed when building the OpenCL source code.