From 45c18f07f9598881bb5e591a0f91d905b5ef1629 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Thu, 23 Feb 2023 09:28:35 -0600 Subject: [PATCH 1/2] Fixes to dpctl-post-link prior changes gh-1081 conda prunes empty folders, so the dpctl tar-ball did not contain empty etc/OpenCL/vendors folder. Solved by create a dummy `.dpctl_readme` file in that folder. The script dpctl-post-link.sh contained a type in the filename it was checking should not exist. --- conda-recipe/build.sh | 1 + conda-recipe/dpctl-post-link.sh | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 0d5eb6936c..0e79a62ef3 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -33,5 +33,6 @@ fi # need to create this folder so ensure that .dpctl-post-link.sh can work correctly mkdir -p $PREFIX/etc/OpenCL/vendors +echo "dpctl creates symbolic link to system installed /etc/OpenCL/vendors/intel.icd as a work-around." > $PREFIX/etc/OpenCL/vendors/.dpctl_readme cp $RECIPE_DIR/dpctl-post-link.sh $PREFIX/bin/.dpctl-post-link.sh diff --git a/conda-recipe/dpctl-post-link.sh b/conda-recipe/dpctl-post-link.sh index 30f26b31c5..976cd3c674 100644 --- a/conda-recipe/dpctl-post-link.sh +++ b/conda-recipe/dpctl-post-link.sh @@ -2,7 +2,8 @@ systemwide_icd=/etc/OpenCL/vendors/intel.icd local_vendors=$CONDA_PREFIX/etc/OpenCL/vendors/ +icd_fn=$local_vendors/intel-ocl-gpu.icd -if [[ -f $systemwide_icd && -d $local_vendors && ! -f $local_vendors/intl-ocl-gpu.icd ]]; then - ln -s $systemwide_icd $local_vendors/intel-ocl-gpu.icd +if [[ -f $systemwide_icd && -d $local_vendors && ! -f $icd_fn ]]; then + ln -s $systemwide_icd $icd_fn fi From 0967621aa1f8ba29c739cb71160d926cc362758d Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Thu, 23 Feb 2023 11:04:18 -0600 Subject: [PATCH 2/2] Added pre-unlink, use instead of /home/opavlyk/miniconda3/envs/dev_dpctl --- conda-recipe/build.sh | 1 + conda-recipe/dpctl-post-link.sh | 2 +- conda-recipe/dpctl-pre-unlink.sh | 8 ++++++++ 3 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 conda-recipe/dpctl-pre-unlink.sh diff --git a/conda-recipe/build.sh b/conda-recipe/build.sh index 0e79a62ef3..2432e0dda6 100755 --- a/conda-recipe/build.sh +++ b/conda-recipe/build.sh @@ -36,3 +36,4 @@ mkdir -p $PREFIX/etc/OpenCL/vendors echo "dpctl creates symbolic link to system installed /etc/OpenCL/vendors/intel.icd as a work-around." > $PREFIX/etc/OpenCL/vendors/.dpctl_readme cp $RECIPE_DIR/dpctl-post-link.sh $PREFIX/bin/.dpctl-post-link.sh +cp $RECIPE_DIR/dpctl-pre-unlink.sh $PREFIX/bin/.dpctl-pre-unlink.sh diff --git a/conda-recipe/dpctl-post-link.sh b/conda-recipe/dpctl-post-link.sh index 976cd3c674..45b1e6856f 100644 --- a/conda-recipe/dpctl-post-link.sh +++ b/conda-recipe/dpctl-post-link.sh @@ -1,7 +1,7 @@ #!/usr/bin/bash systemwide_icd=/etc/OpenCL/vendors/intel.icd -local_vendors=$CONDA_PREFIX/etc/OpenCL/vendors/ +local_vendors=$PREFIX/etc/OpenCL/vendors/ icd_fn=$local_vendors/intel-ocl-gpu.icd if [[ -f $systemwide_icd && -d $local_vendors && ! -f $icd_fn ]]; then diff --git a/conda-recipe/dpctl-pre-unlink.sh b/conda-recipe/dpctl-pre-unlink.sh new file mode 100644 index 0000000000..4d0207720f --- /dev/null +++ b/conda-recipe/dpctl-pre-unlink.sh @@ -0,0 +1,8 @@ +#!/usr/bin/bash + +local_vendors=$PREFIX/etc/OpenCL/vendors/ +icd_fn=$local_vendors/intel-ocl-gpu.icd + +if [[ -L $icd_fn ]]; then + rm $icd_fn +fi