Skip to content

cp2k: native build enabled by default #5780

Description

@drkrynstrng

A native build of CP2K is enabled with the default settings of build_system=cmake build_type=Release, which can override the given Spack architecture target. When using GCC compilers, for example, the compiler flags -march=native -mtune=native are added. This can cause a run-time failure (e.g., illegal instruction) when the build node is a different microarchitecture than compute nodes (e.g., building on an x86_64_v4 node with a target of x86_64_v3).

For reference: https://github.com/cp2k/cp2k/blob/v2026.2/cmake/CompilerConfiguration.cmake#L55

One way to address this issue is to use Spack's filter_file() function to remove or replace compiler flags like -march=native -mtune=native from the CompilerConfiguration.cmake file before the CMake build process begins.

Package maintainers: @mtaillefumier @RMeli @abussy

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions