From 7c9680c3c8a839362e53c2f1267d614194bccaea Mon Sep 17 00:00:00 2001 From: edoapra Date: Sat, 11 Nov 2023 09:25:12 -0800 Subject: [PATCH] threaded OpenBLAS built on conda with OpenMP' https://github.com/nwchemgit/nwchem/pull/908 --- recipe/build.sh | 10 ++++++++++ recipe/meta.yaml | 3 ++- recipe/openblas_openmp.patch | 20 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 recipe/openblas_openmp.patch diff --git a/recipe/build.sh b/recipe/build.sh index d686268..168fbfd 100644 --- a/recipe/build.sh +++ b/recipe/build.sh @@ -32,6 +32,16 @@ fi export ARMCI_NETWORK=$(echo $armci_network | tr "[:lower:]" "[:upper:]" | sed -e 's/_/-/g' ) export USE_OPENMP=y echo "USE_OPENMP is equal to " $USE_OPENMP +#conda packages use OpenMP to thread OpenBLAS +echo "OpenBLAS build_string" $(conda list -f openblas --json|grep string) +(conda list -f openblas --json|grep string | grep openmp1 ) >& /dev/null +if [ $? -eq 0 ] +then + echo openblas built with OpenMP + export OPENBLAS_USES_OPENMP=1 +else + echo openblas built without OpenMP +fi build_arch=$(echo $CONDA_TOOLCHAIN_HOST | cut -d - -f 1) echo "build_arch is $build_arch" export NWCHEM_MODULES="all python gwmol xtb" diff --git a/recipe/meta.yaml b/recipe/meta.yaml index ecba709..c5ed694 100644 --- a/recipe/meta.yaml +++ b/recipe/meta.yaml @@ -3,7 +3,7 @@ {% set hash = "74936fb9" %} {% set date = "2023-11-03" %} -{% set build = 3 %} +{% set build = 4 %} {% set armci_network = armci_network or 'mpi_ts' %} {% if armci_network == 'mpi_ts' %} # prioritize 'nompi' variant via build number @@ -26,6 +26,7 @@ source: - conda_nwchemrc.patch - tblite_omp.patch - osx_headerpad.patch + - openblas_openmp.patch build: number: {{ build }} diff --git a/recipe/openblas_openmp.patch b/recipe/openblas_openmp.patch new file mode 100644 index 0000000..0412459 --- /dev/null +++ b/recipe/openblas_openmp.patch @@ -0,0 +1,20 @@ +diff --git a/src/config/makefile.h b/src/config/makefile.h +index 8754b5ce197af857ad0595bc62b10fe4356b053a..04b3f6abc5ee6d945a4616a2e5f672444e76cff6 100644 +--- a/src/config/makefile.h ++++ b/src/config/makefile.h +@@ -3858,7 +3858,14 @@ ifdef BUILD_OPENBLAS + DEFINES += -DOPENBLAS + endif + ifeq ($(shell echo $(BLASOPT) |awk '/openblas/ {print "Y"; exit}'),Y) +- DEFINES += -DOPENBLAS ++ ifdef OPENBLAS_USES_OPENMP ++ DEFINES += -DBLAS_OPENMP ++ ifndef USE_OPENMP ++ $(error USE_OPENMP must be set when OPENBLAS_USES_OPENMP is set) ++ endif ++ else ++ DEFINES += -DOPENBLAS ++ endif + endif + # NVHPC compilers are distributed wtih OpenBLAS named as libblas/liblapack + ifeq ($(shell echo $(BLASOPT) |awk '/\/nvidia\/hpc_sdk\// {print "Y"; exit}'),Y)