endif()
if(GMX_USE_OPENCL)
- set(OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS})
+ # Install the utility headers
+ file(GLOB OPENCL_INSTALLED_FILES
+ gpu_utils/vectype_ops.clh
+ gpu_utils/device_utils.clh
+ )
+ install(FILES ${OPENCL_INSTALLED_FILES}
+ DESTINATION ${GMX_INSTALL_OCLDIR}/gromacs/gpu_utils
+ COMPONENT libraries)
+ file(GLOB OPENCL_INSTALLED_FILES
+ pbcutil/ishift.h
+ )
+ install(FILES ${OPENCL_INSTALLED_FILES}
+ DESTINATION ${GMX_INSTALL_OCLDIR}/gromacs/pbcutil
+ COMPONENT libraries)
- install(FILES ${OPENCL_KERNELS} DESTINATION
- ${GMX_INSTALL_OCLDIR} COMPONENT libraries)
+ # Install the NB source and headers
+ file(GLOB OPENCL_INSTALLED_FILES
+ mdlib/nbnxn_consts.h
+ )
+ install(FILES ${OPENCL_INSTALLED_FILES}
+ DESTINATION ${GMX_INSTALL_OCLDIR}/gromacs/mdlib
+ COMPONENT libraries)
+ file(GLOB OPENCL_INSTALLED_FILES
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernels.cl
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernel.clh
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernel_pruneonly.clh
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernels.clh
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernels_fastgen.clh
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernels_fastgen_add_twincut.clh
+ mdlib/nbnxn_ocl/nbnxn_ocl_kernel_utils.clh
+ mdlib/nbnxn_ocl/nbnxn_ocl_consts.h
+ )
+ install(FILES ${OPENCL_INSTALLED_FILES}
+ DESTINATION ${GMX_INSTALL_OCLDIR}/gromacs/mdlib/nbnxn_ocl
+ COMPONENT libraries)
+
+ # Install the PME source and headers
+ file(GLOB OPENCL_INSTALLED_FILES
+ ewald/pme-spread.clh
+ ewald/pme-solve.clh
+ ewald/pme-gather.clh
+ ewald/pme-gpu-utils.clh
+ ewald/pme-program.cl
+ ewald/pme-gpu-types.h
+ )
+ install(FILES ${OPENCL_INSTALLED_FILES}
+ DESTINATION ${GMX_INSTALL_OCLDIR}/gromacs/ewald
+ COMPONENT libraries)
endif()
pme-gpu-internal.cpp
pme-gpu-timings.cpp
)
- file(GLOB EWALD_OPENCL_RUNTIME_SOURCES pme-spread.clh pme-solve.clh pme-gather.clh pme-gpu-utils.clh pme-program.cl pme-gpu-types.h)
- set(MDLIB_OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS} ${EWALD_OPENCL_RUNTIME_SOURCES} PARENT_SCOPE)
else()
gmx_add_libgromacs_sources(
# Files that implement stubs
/* TODO when we have a proper MPI-aware logging module,
the log output here should be written there */
program = gmx::ocl::compileProgram(stderr,
- "src/gromacs/ewald",
+ "gromacs/ewald",
"pme-program.cl",
commonDefines,
context,
)
endif()
-if(GMX_USE_OPENCL)
- file(GLOB OPENCL_COMMON_HEADERS
- vectype_ops.clh
- device_utils.clh
- )
- set(MDLIB_OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS} ${OPENCL_COMMON_HEADERS} PARENT_SCOPE)
-endif()
-
# workaround for the state - host allocator dependency
gmx_install_headers(hostallocator.h)
* behavior by defining GMX_OCL_FILE_PATH environment variable.
*
* \param[in] sourceRelativePath Relative path to the kernel or other file in the source tree,
- * e.g. "src/gromacs/mdlib/nbnxn_ocl" for NB kernels.
+ * from src, e.g. "gromacs/mdlib/nbnxn_ocl" for NB kernels.
* \return OS-normalized path string to the folder storing OpenCL source file
*
* \throws std::bad_alloc if out of memory.
root path from the path to the binary that is running. */
InstallationPrefixInfo info = getProgramContext().installationPrefix();
std::string dataPathSuffix = (info.bSourceLayout ?
- sourceRelativePath :
+ "src" :
GMX_INSTALL_OCLDIR);
- sourceRootPath = Path::join(info.path, dataPathSuffix);
+ sourceRootPath = Path::join(info.path, dataPathSuffix, sourceRelativePath);
}
else
{
GMX_THROW(FileIOError(formatString("GMX_OCL_FILE_PATH must point to the directory where OpenCL"
"kernels are found, but '%s' does not exist", gmxOclFilePath)));
}
- sourceRootPath = gmxOclFilePath;
+ sourceRootPath = Path::join(gmxOclFilePath, sourceRelativePath);
}
// Make sure we return an OS-correct path format
ocl_vendor_id_t deviceVendorId)
{
cl_int cl_error;
+ // Let the kernel find include files from its module.
std::string kernelRootPath = getSourceRootPath(kernelRelativePath);
- std::string includeRootPath = getSourceRootPath("src");
+ // Let the kernel find include files from other modules.
+ std::string rootPath = getSourceRootPath("");
GMX_RELEASE_ASSERT(fplog != nullptr, "Need a valid log file for building OpenCL programs");
/* Make the build options */
std::string preprocessorOptions = makePreprocessorOptions(kernelRootPath,
- includeRootPath,
+ rootPath,
getDeviceWarpSize(context, deviceId),
deviceVendorId,
extraDefines);
if(GMX_USE_OPENCL)
file(GLOB OPENCL_NB_SOURCES *.cpp)
set(MDLIB_SOURCES ${MDLIB_SOURCES} ${OPENCL_NB_SOURCES} PARENT_SCOPE)
- file(GLOB MDLIB_OPENCL_KERNELS *.cl *.clh)
- set(MDLIB_OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS} PARENT_SCOPE)
endif()
set(ELEC_DEFS
nb->nbparam->eeltype,
nb->nbparam->vdwtype);
- /* Here we pass macros and static const int variables defined in include
- * files outside the nbnxn_ocl as macros, to avoid including those files
- * in the JIT compilation that happens at runtime.
- */
-
+ /* Here we pass macros and static const int variables defined
+ * in include files outside the nbnxn_ocl as macros, to avoid
+ * including those files in the JIT compilation that happens
+ * at runtime. This is particularly a problem for headers that
+ * depend on config.h, such as nbnxn_pairlist.h. */
extraDefines += gmx::formatString(
" -DNBNXN_GPU_CLUSTER_SIZE=%d "
"%s",
c_nbnxnGpuClusterSize, /* Defined in nbnxn_pairlist.h */
(nb->bPrefetchLjParam) ? "-DIATYPE_SHMEM" : ""
);
-
try
{
/* TODO when we have a proper MPI-aware logging module,
the log output here should be written there */
program = gmx::ocl::compileProgram(stderr,
- "src/gromacs/mdlib/nbnxn_ocl",
+ "gromacs/mdlib/nbnxn_ocl",
"nbnxn_ocl_kernels.cl",
extraDefines,
nb->dev_rundata->context,