-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
gromacs +cp2k: build in CI #40494
gromacs +cp2k: build in CI #40494
Conversation
534f336
to
8a67bda
Compare
@mtaillefumier can you have a look at the CP2K changes? Do you know from what point CP2K switched from the C99 standard to C11? Also I quickly glanced over the cmake build system for CP2K, is it missing Lastly, CP2K also seems to have this issue with mpich 4.1. Any workaround? Or should I put a hard upperbound on mpich 4.0? |
we never switched to c11 or above. cp2k compiles fine with gnu17 (not fully c17 compliant) and should compile with c11 standard as well. |
In this commit it went from const int D = DECIMAL_DIG; // In C11 we could use DBL_DECIMAL_DIG. to const int D = DBL_DECIMAL_DIG; which is in CP2K v2023.2, so pressumably you went from C99 -> C11 during some release? It looks like the toolchain fails to set the relevant -std=c99/c11 flags. Apparently somebody ran into that earlier cause we explicitly set -std=c99 in the spack package, probably cause cp2k failed to compile with compilers that defaulted to c89. |
I do not see any potential issue setting the C standard to c11 though. |
that's the problem when two build systems are present. We always miss something in the process. So the only way to fix it is to enforce c11 in the spack recipe and the cmake build system. Actually the cmake build system will default to gnu17 for gcc 12 and 13. @haampie do you want me to do it ? |
Note it will require a PR in cp2k as well for the cmake build and we must have a workaround for the recipe (-DCMAKE_C_STANDARD) crossing our fingers that the standard defined for each target does not overwrite this. |
I've created a PR cp2k/cp2k#3038. I'd much rather use the CMake build system to be honest, exactly cause CMake knows how to set the language related flags, and the other build system (toolchain?) doesn't seem to care about it at all. |
I agree with you. But the toolchain is not going to disappear anytime soon. This problem is also related to this issue I wanted to enforce cmake use in spack with 2023.2 but my proposal was controversial. master should enforce cmake otherwise we will always have these problems. |
No, see https://en.cppreference.com/w/c/types/limits#Limits_of_floating_point_types for reference, -std=c99 fails correctly, CP2K is using C11. |
good to know thanks. That's why it is failing std=c99. |
We have to fix the recipe. |
For my understanding, it looks like the CMake build of CP2K uses DBCSR as a separate package, whereas the toolchain is using the internal copy of DBCSR, or not? I'd much rather use DBCSR as a separate package, cause otherwise we have to duplicate all conflicts and compat bounds from the DBCSR package into CP2K. (Right now: mpich 4.1 compatibility and fixes to make it work).
Yeah, that's done in this PR ;) |
@@ -82,6 +82,9 @@ class Libxsmm(MakefilePackage): | |||
# (<https://github.com/spack/spack/pull/21671#issuecomment-779882282>). | |||
depends_on("binutils+ld+gas@2.33:", type="build", when="@:1.17") | |||
|
|||
# Intel Architecture or compatible CPU required | |||
requires("target=x86_64:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hfp is this OK? I wanna turn the configure/build time error into a constraint, s.t. packages like dbcsr automatically use ordinary blas instead of libxsmm on arm / powerpc
You are right. DBCSR is an external package. I only added the option to build dbcsr with cp2k but i do not like the idea from the first place. That's also why the this option is not available with the spack recipe. If people build cp2k with spack and cmake then dbcsr will be considered external dependency. I am not going to change this what ever users want it or not. |
PR cp2k/cp2k#3039 for cp2k. Will solve issue #40372 at the same time. |
NB : dbcsr dependence is only activated when the build system is cmake. |
Ok yeah. Whatever the default build system is, we can always decide to build with cmake in our CI 🙃 I think that's much better, given the dbcsr + mpich 4.1 issues... duplicating all dbcsr constraints in cp2k sounds like a bad idea. Just pushed that, so we test |
I've opened #40505 about going forward with |
gromacs cannot locate cp2k through pkg-config when using build_system=cmake @mtaillefumier, does it generate a different pkg config file from the toolchain? |
I am sure I generate the pkgconfig file. I suspect I do not install it. One more fix |
You can also use find_package(cp2k). these files are installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nothing to say. Approved.
gromacs+cp2k builds fine for x86 / arm / ppc, so should be good to go |
# C standard was omitted in the first release with CMake build system. | ||
# https://github.com/cp2k/cp2k/pull/3039 | ||
if spec.satisfies("@2023.2"): | ||
args.append(self.define("CMAKE_C_STANDARD", "11")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still useful given the patch?
# Use of DBL_DECIMAL_DIG | ||
cflags.append(self.compiler.c11_flag) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this still useful given the patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one should stay, it's for the other build system
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
85cb6c0
to
0713eb1
Compare
0713eb1
to
d4f3cd8
Compare
@@ -277,11 +277,10 @@ class Cp2k(MakefilePackage, CudaPackage, CMakePackage, ROCmPackage): | |||
|
|||
with when("build_system=cmake"): | |||
depends_on("dbcsr") | |||
depends_on("dbcsr@2.6:", when="@2023.2:") | |||
depends_on("dbcsr@2.6:") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this when condition was implied by build_system=cmake
already
d4f3cd8
to
ea70a1d
Compare
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
* gromacs +cp2k: build in CI * libxsmm: x86 only * attempt to fix dbcsr + new mpich * use c11 standard * gromacs: does not depend on dbcsr * cp2k: build with cmake in CI, s.t. dbcsr is a separate package * cp2k: cmake patches for config files and C/C++ std * cp2k: remove unnecessary constraints due to patch
Since there were some issues with
gromacs
, lets build it in CI, togetherwith
cp2k
, which is an important and currently untested package inSpack.
Overview of changes:
x86_64:
inlibxsmm
s.t.dbcsr
will default to ordinary BLAS on aarch64 / ppc64;dbcsr
andmpich@4.1:
-- needsmpi_f08
;cp2k
, for either build systemcp2k build_system=cmake
that fixes installed config filesdbcsr
fromgromacs+cp2k
; it's not a direct dep, it's a dep ofcp2k