diff --git a/math/dbcsr/Portfile b/math/dbcsr/Portfile index 72bdbd27d21bf..ac1dfc3790285 100644 --- a/math/dbcsr/Portfile +++ b/math/dbcsr/Portfile @@ -3,6 +3,7 @@ PortSystem 1.0 PortGroup cmake 1.1 PortGroup github 1.0 +PortGroup linear_algebra 1.0 PortGroup mpi 1.0 github.setup cp2k dbcsr 2.5.0 v @@ -26,7 +27,6 @@ set py_ver_nodot [string map {. {}} ${py_ver}] depends_build-append \ port:py${py_ver_nodot}-fypp \ port:python${py_ver_nodot} -depends_lib-append path:lib/libopenblas.dylib:OpenBLAS if {${os.platform} eq "darwin" && ${os.arch} eq "powerpc"} { mpi.setup require require_fortran \ @@ -37,17 +37,42 @@ if {${os.platform} eq "darwin" && ${os.arch} eq "powerpc"} { -gcc44 -gcc45 -gcc46 -gcc47 -gcc48 -gcc49 -gcc5 -gcc6 } -compiler.cxx_standard 2014 +compiler.cxx_standard 2014 +compiler.openmp_version 4.5 + +# OpenBLAS is not properly supported for Apple yet: +# https://github.com/cp2k/dbcsr/issues/645 +# It is confirmed to be broken on PPC. +if {[variant_isset accelerate]} { + patchfiles-append \ + patch-accelerate.diff +} + +# For now, disabling because of this: +# https://github.com/cp2k/dbcsr/issues/645#issuecomment-1382381278 +# pre-configure { +# configure.args-append \ +# -DMPI_RUN_COMMAND=${prefix}/bin/${mpi.exec} \ +# -DMPIEXEC_EXECUTABLE=${prefix}/bin/${mpi.exec} \ +# } configure.args-append \ -DPython_EXECUTABLE=${prefix}/bin/python${py_ver} \ -DFYPP_EXECUTABLE=${prefix}/bin/fypp-${py_ver} \ -DUSE_MPI=ON \ - -DUSE_OPENMP=OFF \ + -DUSE_OPENMP=ON \ + -DUSE_SMM=blas \ -DWITH_C_API=ON \ -DWITH_CUDA_PROFILING=OFF \ -DBUILD_TESTING=ON \ + -DTEST_OMP_THREADS=2 \ + -DTEST_MPI_RANKS=4 \ -DWITH_EXAMPLES=OFF +pre-test { + # test infrastructure uses /bin/ps, which is forbidden by sandboxing + append portsandbox_profile " (allow process-exec (literal \"/bin/ps\") (with no-profile))" +} + test.run yes test.cmd ctest diff --git a/math/dbcsr/files/patch-accelerate.diff b/math/dbcsr/files/patch-accelerate.diff new file mode 100644 index 0000000000000..9d54bd451a66b --- /dev/null +++ b/math/dbcsr/files/patch-accelerate.diff @@ -0,0 +1,16 @@ +# It does not get picked correctly when conditional. + +--- src/CMakeLists.txt.orig 2022-12-28 04:24:55.000000000 +0700 ++++ src/CMakeLists.txt 2023-01-14 18:54:26.000000000 +0700 +@@ -175,10 +175,7 @@ + if (APPLE) + # fix /proc/self/statm can not be opened on macOS + target_compile_definitions(dbcsr PRIVATE __NO_STATM_ACCESS) +- +- if (BLAS_LIBRARIES MATCHES "Accelerate") +- target_compile_definitions(dbcsr PRIVATE __ACCELERATE) +- endif () ++ target_compile_definitions(dbcsr PRIVATE __ACCELERATE) + endif () + + # set -DNDEBUG for Release builds