Skip to content

Commit

Permalink
threaded OpenBLAS built on conda with OpenMP' nwchemgit/nwchem#908
Browse files Browse the repository at this point in the history
  • Loading branch information
edoapra committed Nov 11, 2023
1 parent 01caf21 commit 7c9680c
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 1 deletion.
10 changes: 10 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 2 additions & 1 deletion recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -26,6 +26,7 @@ source:
- conda_nwchemrc.patch
- tblite_omp.patch
- osx_headerpad.patch
- openblas_openmp.patch

build:
number: {{ build }}
Expand Down
20 changes: 20 additions & 0 deletions recipe/openblas_openmp.patch
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 7c9680c

Please sign in to comment.