Unverified Commit 9fe1bae6 authored by Peter Eastman's avatar Peter Eastman Committed by GitHub
Browse files

Use Intel OpenCL for CI (#4366)

* Use Intel OpenCL for CI

* Set environment variables

* Try to get CI to run

* Debugging

* Debugging

* Fixes for Intel OpenCL
parent d7307530
...@@ -70,7 +70,7 @@ jobs: ...@@ -70,7 +70,7 @@ jobs:
-DCUDA_TOOLKIT_INCLUDE=/usr/local/cuda-11.2/include \ -DCUDA_TOOLKIT_INCLUDE=/usr/local/cuda-11.2/include \
-DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.2/ \ -DCUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda-11.2/ \
- name: Linux AMD OpenCL - name: Linux Intel OpenCL
os: ubuntu-latest os: ubuntu-latest
env: ubuntu-latest env: ubuntu-latest
python-version: "3.13" python-version: "3.13"
...@@ -88,8 +88,6 @@ jobs: ...@@ -88,8 +88,6 @@ jobs:
-DOPENMM_BUILD_PYTHON_WRAPPERS=OFF \ -DOPENMM_BUILD_PYTHON_WRAPPERS=OFF \
-DOPENMM_BUILD_C_AND_FORTRAN_WRAPPERS=OFF \ -DOPENMM_BUILD_C_AND_FORTRAN_WRAPPERS=OFF \
-DOPENMM_BUILD_EXAMPLES=OFF \ -DOPENMM_BUILD_EXAMPLES=OFF \
-DOPENCL_INCLUDE_DIR=${GITHUB_WORKSPACE}/AMDAPPSDK/include \
-DOPENCL_LIBRARY=${GITHUB_WORKSPACE}/AMDAPPSDK/lib/x86_64/libOpenCL.so \
- name: Linux HIP - name: Linux HIP
os: ubuntu-latest os: ubuntu-latest
...@@ -213,7 +211,7 @@ jobs: ...@@ -213,7 +211,7 @@ jobs:
- name: "Install OpenCL on Ubuntu (if needed)" - name: "Install OpenCL on Ubuntu (if needed)"
if: matrix.OPENCL == true && startsWith(matrix.os, 'ubuntu') if: matrix.OPENCL == true && startsWith(matrix.os, 'ubuntu')
run: source devtools/ci/gh-actions/scripts/install_amd_opencl.sh run: source devtools/ci/gh-actions/scripts/install_intel_opencl.sh
- name: "Install conda-forge compilers on Ubuntu or M1 (if needed)" - name: "Install conda-forge compilers on Ubuntu or M1 (if needed)"
if: matrix.compilers == 'conda-forge' if: matrix.compilers == 'conda-forge'
...@@ -278,6 +276,9 @@ jobs: ...@@ -278,6 +276,9 @@ jobs:
run: | run: |
set -x set -x
cd build cd build
if [[ ${{ matrix.OPENCL }} == true ]]; then
source /opt/intel/oneapi/setvars.sh
fi
python ../devtools/run-ctest.py --parallel 2 --timeout 600 --job-duration 900 --attempts 3 python ../devtools/run-ctest.py --parallel 2 --timeout 600 --job-duration 900 --attempts 3
if [[ ${{ matrix.os }} == ubuntu-* ]]; then SHLIB=so; else SHLIB=dylib; fi if [[ ${{ matrix.os }} == ubuntu-* ]]; then SHLIB=so; else SHLIB=dylib; fi
......
# This script installs Intel's OpenCL for CPUs.
set -euxo pipefail
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB | gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
sudo apt update
sudo apt install intel-basekit intel-hpckit intel-oneapi-runtime-opencl opencl-headers ocl-icd-opencl-dev -y
...@@ -4465,7 +4465,7 @@ double CommonCalcCustomHbondForceKernel::execute(ContextImpl& context, bool incl ...@@ -4465,7 +4465,7 @@ double CommonCalcCustomHbondForceKernel::execute(ContextImpl& context, bool incl
setPeriodicBoxArgs(cc, forceKernel, 6); setPeriodicBoxArgs(cc, forceKernel, 6);
int numDonorBlocks = (numDonors+31)/32; int numDonorBlocks = (numDonors+31)/32;
int numAcceptorBlocks = (numAcceptors+31)/32; int numAcceptorBlocks = (numAcceptors+31)/32;
forceKernel->execute(numDonorBlocks*numAcceptorBlocks*32, cc.getIsCPU() ? 32 : 128); forceKernel->execute(numDonorBlocks*numAcceptorBlocks*32, cc.getSIMDWidth() < 32 ? 32 : 128);
return 0.0; return 0.0;
} }
......
...@@ -125,7 +125,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device ...@@ -125,7 +125,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
string platformVendor = platforms[j].getInfo<CL_PLATFORM_VENDOR>(); string platformVendor = platforms[j].getInfo<CL_PLATFORM_VENDOR>();
vector<cl::Device> devices; vector<cl::Device> devices;
try { try {
platforms[j].getDevices(CL_DEVICE_TYPE_ALL, &devices); platforms[j].getDevices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_CPU, &devices);
} }
catch (...) { catch (...) {
// There are no devices available for this platform. // There are no devices available for this platform.
...@@ -197,7 +197,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device ...@@ -197,7 +197,7 @@ OpenCLContext::OpenCLContext(const System& system, int platformIndex, int device
cout << "WARNING: Using an unsupported OpenCL implementation. Results may be incorrect." << endl; cout << "WARNING: Using an unsupported OpenCL implementation. Results may be incorrect." << endl;
vector<cl::Device> devices; vector<cl::Device> devices;
platforms[bestPlatform].getDevices(CL_DEVICE_TYPE_ALL, &devices); platforms[bestPlatform].getDevices(CL_DEVICE_TYPE_GPU | CL_DEVICE_TYPE_CPU, &devices);
string platformVendor = platforms[bestPlatform].getInfo<CL_PLATFORM_VENDOR>(); string platformVendor = platforms[bestPlatform].getInfo<CL_PLATFORM_VENDOR>();
device = devices[bestDevice]; device = devices[bestDevice];
......
...@@ -56,6 +56,12 @@ OpenCLFFT3D::OpenCLFFT3D(OpenCLContext& context, int xsize, int ysize, int zsize ...@@ -56,6 +56,12 @@ OpenCLFFT3D::OpenCLFFT3D(OpenCLContext& context, int xsize, int ysize, int zsize
config.inputBufferStride[0] = zsize; config.inputBufferStride[0] = zsize;
config.inputBufferStride[1] = ysize*zsize; config.inputBufferStride[1] = ysize*zsize;
config.inputBufferStride[2] = xsize*ysize*zsize; config.inputBufferStride[2] = xsize*ysize*zsize;
cl::Platform platform(context.getDevice().getInfo<CL_DEVICE_PLATFORM>());
string platformVendor = platform.getInfo<CL_PLATFORM_VENDOR>();
if (platformVendor.size() >= 5 && platformVendor.substr(0, 5) == "Intel") {
// Intel's OpenCL uses low accuracy trig functions, so tell VkFFT to use lookup tables instead.
config.useLUT = 1;
}
VkFFTResult result = initializeVkFFT(&app, config); VkFFTResult result = initializeVkFFT(&app, config);
if (result != VKFFT_SUCCESS) if (result != VKFFT_SUCCESS)
throw OpenMMException("Error initializing VkFFT: "+context.intToString(result)); throw OpenMMException("Error initializing VkFFT: "+context.intToString(result));
......
...@@ -54,9 +54,9 @@ bool canRunHugeTest() { ...@@ -54,9 +54,9 @@ bool canRunHugeTest() {
platforms[platformIndex].getDevices(CL_DEVICE_TYPE_ALL, &devices); platforms[platformIndex].getDevices(CL_DEVICE_TYPE_ALL, &devices);
long long memory = devices[deviceIndex].getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>(); long long memory = devices[deviceIndex].getInfo<CL_DEVICE_GLOBAL_MEM_SIZE>();
// Only run the huge test if the device has at least 4 GB of memory. // Only run the huge test if the device has at least 8 GB of memory.
return (memory >= 4*(long long)(1<<30)); return (memory >= 8*(long long)(1<<30));
} }
void runPlatformTests() { void runPlatformTests() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment