Last active
October 6, 2022 00:56
-
-
Save matthiasdiener/838ccbdb5d8f4e4917b58fe3da811777 to your computer and use it in GitHub Desktop.
Script to build pocl and pyopencl from source
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -o errexit | |
pushd . | |
### Conda | |
MINIFORGE_INSTALL_PREFIX=$PWD/miniforge3 | |
rm -f Miniforge3-Linux-ppc64le.sh | |
rm -rf $MINIFORGE_INSTALL_PREFIX | |
wget https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-ppc64le.sh | |
bash Miniforge3-Linux-ppc64le.sh -b -p $MINIFORGE_INSTALL_PREFIX | |
source $MINIFORGE_INSTALL_PREFIX/bin/activate | |
conda update --all --yes | |
conda create --yes --name poclbuild | |
conda activate poclbuild | |
conda install --yes clang clangxx clangdev gxx_impl_linux-ppc64le libhwloc=1 cmake ocl-icd pybind11 mako | |
### Pocl | |
set -o nounset | |
echo CUDA_HOME=$CUDA_HOME | |
rm -rf pocl | |
git clone github.com:pocl/pocl | |
cd pocl | |
export POCL_INSTALL_PREFIX=$PWD/install | |
export CPATH=$MINIFORGE_INSTALL_PREFIX/envs/poclbuild/include | |
export LIBRARY_PATH=$MINIFORGE_INSTALL_PREFIX/envs/poclbuild/lib:$CUDA_HOME/lib64/stubs:/usr/lib/x86_64-linux-gnu/ | |
mkdir build | |
cd build | |
CC=clang CXX=clang++ cmake .. \ | |
-DENABLE_CUDA=on \ | |
-DENABLE_ICD=on \ | |
-DCMAKE_BUILD_TYPE="RelWithDebugInfo" \ | |
-DCMAKE_INSTALL_PREFIX=$POCL_INSTALL_PREFIX \ | |
-DOPENCL_LIBRARIES=$MINIFORGE_INSTALL_PREFIX/envs/poclbuild/lib/libOpenCL.so \ | |
-DCLANG_MARCH_FLAG="-mcpu=" | |
make -j8 | |
make install | |
### Pyopencl | |
popd | |
rm -rf pyopencl | |
# N.B. Make sure to load a recent gcc module (>7) | |
git clone --recursive [email protected]:inducer/pyopencl | |
cd pyopencl | |
./configure.py --cl-inc-dir=$MINIFORGE_INSTALL_PREFIX/envs/poclbuild/include --cl-lib-dir=$POCL_INSTALL_PREFIX/lib --cl-libname=OpenCL | |
python setup.py install | |
export OCL_ICD_VENDORS=$POCL_INSTALL_PREFIX/etc/OpenCL/vendors/:$OCL_ICD_VENDORS | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you @ZwFink!