Gromacs  2024.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Functions | Variables
ocl_compiler.cpp File Reference
#include "gmxpre.h"
#include "ocl_compiler.h"
#include "config.h"
#include <cstdio>
#include <algorithm>
#include <filesystem>
#include <string>
#include <vector>
#include "gromacs/gpu_utils/oclutils.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/path.h"
#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/smalloc.h"
#include "gromacs/utility/stringutil.h"
#include "gromacs/utility/textreader.h"
#include "gromacs/utility/unique_cptr.h"
#include "ocl_caching.h"
+ Include dependency graph for ocl_compiler.cpp:

Description

Define infrastructure for OpenCL JIT compilation for Gromacs.

Author
Dimitrios Karkoulis dimit.nosp@m.ris..nosp@m.karko.nosp@m.ulis.nosp@m.@gmai.nosp@m.l.co.nosp@m.m
Anca Hamuraru anca@.nosp@m.stre.nosp@m.amcom.nosp@m.puti.nosp@m.ng.eu
Teemu Virolainen teemu.nosp@m.@str.nosp@m.eamco.nosp@m.mput.nosp@m.ing.e.nosp@m.u
Mark Abraham mark..nosp@m.j.ab.nosp@m.raham.nosp@m.@gma.nosp@m.il.co.nosp@m.m

Functions

static void gmx::ocl::writeOclBuildLog (FILE *fplog, cl_program program, cl_device_id deviceId, const std::string &kernelFilename, const std::string &preprocessorOptions, bool buildFailed)
 Handles writing the OpenCL JIT compilation log to fplog. More...
 
static std::string gmx::ocl::selectCompilerOptions (DeviceVendor deviceVendor)
 Construct compiler options string. More...
 
static std::filesystem::path gmx::ocl::getSourceRootPath (const std::string &sourceRelativePath)
 Get the path to the folder storing an OpenCL source file. More...
 
size_t gmx::ocl::getKernelWarpSize (cl_kernel kernel, cl_device_id deviceId)
 Get the kernel-specific warp size. More...
 
size_t gmx::ocl::getDeviceWarpSize (cl_context context, cl_device_id deviceId)
 Get the device-specific warp size. More...
 
static std::string gmx::ocl::makeVendorFlavorChoice (DeviceVendor deviceVendor)
 Select a compilation-line define for a vendor-specific kernel choice from vendor id. More...
 
static std::string gmx::ocl::makeKernelIncludePathOption (const std::string &unescapedKernelRootPath)
 Create include paths for kernel sources. More...
 
static void gmx::ocl::removeExtraSpaces (std::string *str)
 Replace duplicated spaces with a single one in string. More...
 
static std::string gmx::ocl::makePreprocessorOptions (const std::filesystem::path &kernelRootPath, const std::filesystem::path &includeRootPath, size_t warpSize, DeviceVendor deviceVendor, const std::string &extraDefines)
 Builds a string with build options for the OpenCL kernels. More...
 
cl_program gmx::ocl::compileProgram (FILE *fplog, const std::string &kernelRelativePath, const std::string &kernelBaseFilename, const std::string &extraDefines, cl_context context, cl_device_id deviceId, DeviceVendor deviceVendor)
 Compile the specified kernel for the context and device. More...
 

Variables

static bool gmx::ocl::useBuildCache = getenv("GMX_OCL_GENCACHE") != nullptr
 True if OpenCL binary caching is enabled. More...