Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dbcsr: use Accelerate as default, fix tests #17344

Merged
merged 1 commit into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 28 additions & 3 deletions math/dbcsr/Portfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 \
Expand All @@ -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
16 changes: 16 additions & 0 deletions math/dbcsr/files/patch-accelerate.diff
Original file line number Diff line number Diff line change
@@ -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