Commit graph

66 commits

Author SHA1 Message Date
Taillefumier Mathieu
f50e850e17
[cmake] Cleanup accross the entire build system (#5527)
Co-authored-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
2026-07-04 20:36:14 +02:00
HE Zilong
d275998fba
Precommit: check for CPASSERT(.FALSE.), and empty CPABORT() (#5491) 2026-07-03 12:09:01 +02:00
Taillefumier Mathieu
695da86d0c
Grid gpu engines merge (#5206)
Co-authored-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
2026-05-16 19:18:57 +02:00
Hans Pabst
8ebf9ad0d0 ELPA: introduced ELPA_ONE_STAGE and revised ELPA_QR/UNSAFE
- Introduced ELPA_ONE_STAGE (see #4683).
- QR factorization (unsafe is now internal).
- Removed keyword ELPA_QR_UNSAFE.
- Updated to ELPA 2025.06.002.
- Disabled IEEE exceptions.
- Test coverage.
2026-01-21 13:33:40 +01:00
Ole Schütt
cc4239a96c CMake: Set -D__NO_STATM_ACCESS on BSD 2026-01-13 13:58:58 +01:00
Hans Pabst
ffde6a3702 ELPA: compile-time choice for solver-kind
- For the OpenCL based GPU code-path, or by choice, ELPA may not be built with GPU support.
- Introduced __NO_OFFLOAD_ELPA to allow CPU-only ELPA (related to #4617).
- Allow compile-time selection of ELPA solver-kind (1-stage vs 2-stage).
- For ELPA/SYCL, use 1-stage ELPA solver by default for the time being.
- ELPA/SYCL (MKL in general?) has an index-fix currently only in a branch.

Index/ILP issue (undefined behavior):
- ELPA eventually mismatches index-kinds (LP64 vs ILP64 when linking BLAS/MKL).
- For static linkage it usually does not not matter (at least CPU-only).
- CP2K links the correct BLAS flavor (SO and GPU-build may be affected?).
- ELPA 2-stage may be even affected beyond MKL (or for GPU in general).
- ELPA 1-stage is apparently not affected by index issue.
2026-01-09 10:44:52 +01:00
Franz Pöschel
7c648bcc1f
Add openPMD output 2026-01-06 12:57:32 +01:00
Ole Schütt
449fa423b8 Remove flag __FFTW3_UNALIGNED 2025-12-19 15:01:55 +01:00
Ole Schütt
a53587514b Docs: Move content from INSTALL.md to manual and adopt to CMake 2025-12-18 17:44:29 +01:00
Ole Schütt
633ab399f6 CMake: Make __OFFLOAD_PROFILING flag accessible 2025-12-18 14:59:53 +01:00
Ole Schütt
53d694d2f1 FM: Use __OFFLOAD flags for ELPA as well 2025-12-18 14:59:53 +01:00
Ole Schütt
7bf99f7a74 Remove old flags __HAS_PATCHED_CUFFT_70, __NO_MPI_THREAD_SUPPORT_CHECK, and __MINGW 2025-12-18 14:59:53 +01:00
Ole Schütt
de43aba82f Remove QUIP 2025-12-18 13:07:03 +01:00
Ole Schütt
9e35fc8c04 Precommit: Add Check for docu of CMake options 2025-12-17 15:56:06 +01:00
Ole Schütt
88de2562c6 Precommit: Update check for build flags 2025-12-17 15:56:06 +01:00
Hans Pabst
4a2d255c13 GRID: leverage offload mempool 2025-10-25 21:10:23 +02:00
Hans Pabst
ad3ce71a45 Restore BSD-3 license for C-based MPI-wrapper 2025-10-17 09:54:57 +02:00
Hans Pabst
50b0971e18 DBM mempool to offload and mpi/c to mpiwrap
- Introduced offload_mempool_stats_print to Fortran API.
- Print memory statistics independent of DBM (and grid).
- Avoid circular dependency (string_utilities/strlcpy_c2f).
- Use up-leveled MPI/C wrapper.

* MPI/C wrapper (dbm_mpi_ to cp_mpi_)
  - Adjusted license of C-MPI wrapper (consequence of mpiwrap).
  - Moved wrapper for C languages in to mpiwrap directory.
  - Avoid name clash (same basename as for Fortran).
  - Renamed prefix of all MPI wrapper functions.

* Other (DBM):
  - Improved handling errors (OFFLOAD_CHECK before launch).
  - Permit/Adjusted preprocessor symbol (precommit hook).
  - Avoid multi-line control-flow w/o curly braces.
  - Double-check #4428 (DBM_MULTIPLY_COMM_MEMPOOL).

* TODO
  - Apply offload/print_func pattern to GRID's print_func.
  - Leverage offload_mempool for grid backend.
2025-09-30 16:02:16 +02:00
Hans Pabst
7face5689e DBM/OFFLOAD: prepared for hybrid execution
- Split backend_upload_packs into two phases on GPU.
- Initial phase is chosen to have not triggered upload.
- Offload: offloadEventQuery to check if GPU is busy.
- Removed dbm_multiply_gpu_download_results
- Transfers are launched as early as possible.
- Improved overlap between transfer/compute.
- Idea: proceed on CPU if GPU is busy.

Other changes:
- Documented way to perform validation (ctx=NULL).
- Permit DBM_ prefix for preprocessor symbols.
- Removed C-shard pointer from GPU-context.
- Per-shard event stored/provided by shard.
- Migrated CPU-options into context.
- Miniapp: allow to omit validation.
- Use preincrement (atomic).
2025-09-04 13:27:08 +02:00
Hans Pabst
0e80b46be4
DBM: optionally reuse DBCSR's libsmm_acc_process (#4109)
- Experimented with specialized vs DBM's universal kernel.
- Performance is equal likey due to data mix/sort (TODO).
- DBCSR/unrelated: Likely introduce DBM-kernel (cleaner).
- Rely on OPENCL_LIBSMM_PFORMAT.

Mempool:
- Revised default to skip mempool for host-allocs if offload
  is not compiled-in or if offload-allocs on host are disabled.
- Renamed and split DBM_ALLOCATION_FACTOR.
- Separate DBM_OVERCOMMIT_DEVICE/HOST.
- More rigid control of mempool config
- Conditionally define mempool lists.

Other:
- Passing batch/task data in const-correct fashion.
- Revised verbose output.
2025-03-28 09:28:11 +01:00
Hans Pabst
3018857f05
DBM: solved issues with MPI based memory allocation (#4090)
- Assert correct size scaled by DBM_ALLOCATION_FACTOR.
- OpenCL: adjusted verbose output.
2025-03-21 15:57:59 +01:00
Hans Pabst
4136e1a5fc
DBM: adjusted MPI-based memory allocation (#4085)
- Apparently, MPI_Alloc_mem/free are not fully thread-safe.
- Debug shows issue similar to issues reported elsewhere.
- Note: MPI_Alloc_mem was taken out of critical section.
2025-03-18 22:00:45 +01:00
Hans Pabst
eb25494c3c
DBM: use host_malloc, introduced host_free and device_free (#4073)
- Internally, use separate pools for device/host memory.
- Let hyperparams enable/disable pooled memory
   - DBM_OFFLOAD_ALLOC
   - DBM_MEMPOOL_DEVICE
   - DBM_MEMPOOL_HOST
- Let hyperparam control offload memory (host).
2025-03-14 14:29:43 +01:00
Hans Pabst
91946afd07
DBM_VALIDATE_AGAINST_LIBXSMM to enable internal validation (#4048)
- Compile-time/opt-in with -DDBM_VALIDATE_AGAINST_LIBXSMM.
- TODO: more sophistication like injecting error margin.
2025-03-04 16:06:29 +01:00
Ole Schütt
36ef995dc8 Precommit: Touch up check_file_properties.py 2025-03-01 12:06:30 +01:00
Taillefumier Mathieu
cbdeaffe0e
Make GRPP an internal dependency
Co-authored-by: Mathieu Taillefumier <mathieu.taillefumier@free.fr>
2025-02-28 09:36:16 +01:00
Hans Pabst
0217dce9c4
DBM/OCL: option to use SLM as private scratch (#4033)
- DBM_MULTIPLY_SM to use SLM (instead of regs).
- Adjusted permitted preprocessor symbols.
- Control GEN depending on other kernel parameters.
- Avoid bank-conflicts (POT).

- Makefile: miniapp
  - Allow to select GNU Compiler by the means of "make GNU=1".
  - Find <acc_opencl.h> after PR #3994.

- Offload/OCL
  - Implemented offloadGetErrorName and offloadGetLastError.
  - Backward-compatible with DBCSR (OpenCL backend).
2025-02-27 10:53:44 +01:00
Ole Schütt
d59d53cc66 precommit: Touch up DOI check 2024-12-15 13:47:38 +01:00
Hans Pabst
262480dea4
OMP/TRACE: support more comprehensive set of issues (#3784)
- Print issues with in categories: error, warn, info messages.
- Trace additional events and sources of deadlocks and other issues.
- Allow compilation with GNU even if "omp-tools.h" is not present.
- Allow singular translation units under BSD-3 license.
- Print more accurate location of warning.
2024-11-21 14:23:24 +01:00
Hans Pabst
e8c0fe6317
OMP/TRACE: trace-level/verbosity and code location (#3773)
CP2K_OMP_TRACE=1: assert errors at the place/location of the issue (nice debug experience)
CP2K_OMP_TRACE=2: print error issues (printing the code location needs debug symbols)
CP2K_OMP_TRACE=3: print warnings or info messages (when CP2K terminates)

Printing instead of asserting issues (errors, warnings, info) benefits from debug symbols. A negative value of CP2K_OMP_TRACE represents maximum verbosity.
2024-11-12 14:19:56 +01:00
Hans Pabst
4d95af2b47
ocl: removed two variants of the DBM kernel and cleanup (#3761) 2024-11-07 12:58:05 +01:00
Hans Pabst
63804e02b9 Introduced CPVERSION_CHECK macro
- Adjusted uses of plain CPVERSION accordingly.
- Introduced FTN_NO_DEFAULT_INIT workaround.
2024-09-27 20:25:53 +02:00
Hans Pabst
538a8dc7a9
LIBXSMM: keep compatibility with v1.17 (#3676) 2024-09-13 09:31:43 +02:00
Hans Pabst
352d1c2474
Updated LIBXSMM (#3577) 2024-09-06 12:37:22 +02:00
Hans Pabst
42d1e6b4da IFX: use __INTEL_LLVM_COMPILER instead of __MKL
* Note: it is common to use MKL even for non-Intel compiler
2024-08-16 15:02:23 +02:00
Frederick Stein
537841399b Initialize DBCSR_related variables 2024-08-13 10:14:45 +02:00
Hans Pabst
25edd69807
DBM: OpenCL implementation (#3375)
* There are three main implementations
  1. DBM_MULTIPLY_SPLIT=1: default kernel with smallest LOC-number uses private/register-backed buffer. This implementation is simple and performs best even on different vendor's GPUs. There is moderate unrolling/code-bloat leveraging macros. Though, there is no "old school GPU" like copy-into SLM; if there is re-use, it leverage existing caches between registers and global memory.
  2. DBM_MULTIPLY_SPLIT=2..N with DBM_MULTIPLY_SPLIT=8 matching the CUDA implementation using shared/local memory. This implementation matches the existing CUDA implementation and perform equal and reasonable across GPUs. There is moderate unrolling/code-bloat leveraging macros; heuristics are revised/different from CUDA implementation (less cases).
  3. DBM_MULTIPLY_GEN=1: uses https://github.com/intel/tiny-tensor-compiler and IR describing DBM's input format. The IR-file (https://github.com/hfp/cp2k/blob/master/src/dbm/dbm_multiply_opencl.ir) is not part of PR. The generated kernel-code is not yet competitive.
* The amount of code in the OpenCL-kernel and and C based glue-code can be *significantly* reduced (fraction of LOC) when removing for instance implementation 2 and 3 (above mentioned). Reducing the number of LOC can be part of a future cleanup (and once code is settled).
* check_file_properties.py: support C-comments, and omit checking OpenCL source code (it is usually compiled at runtime, i.e., machine-driven rather than user-controlled).
2024-04-29 12:23:24 +02:00
Hans Pabst
aa4adac34c
DBM: introduced OpenCL support (#3321) 2024-03-15 16:41:35 +01:00
Hans Pabst
4b070db377 Offload: support OpenCL
* This work "short-cuts" supporting OpenCL by leveraging DBCSR's OpenCL backend to implement CP2K's Offload interface.
  - Future work (may be soon) can decide/settle where the actual glue code is hosted making the "OpenCL backend".
  - OpenCL is very close to CUDA (streams/queues, events, etc), however, an OpenCL backend accounts for differences.
  - Pointer arithmetic on the host using device pointers is not supported with OpenCL without additional effort.
  - OpenCL abstracts device memory being "cl_mem" structure and does not expose actual device pointers.
* Some functions on CP2K's Offload interface (once derived from DBCSR's ACC interface) remain "TODO".
* For the time being offload_runtime.h "disables" support for Grid and PW/FFTs
  - Defines for __NO_OFFLOAD_GRID and __NO_OFFLOAD_PW must be still given for the Fortran code.
* Some changes remove CUDA and HIP specific code-paths by relying on Offload runtime (e.g., offload_create_buffer).
* Some changes also address problematic code format (multi-line control-flow w/o curly braces/block, etc).
* Further updating INSTALL.md and white-listing/removing certain items are part of follow-up changes.
* Cleaned FLAG_EXCEPTIONS (tools/precommit/check_file_properties.py).
2024-03-13 09:44:46 +01:00
Ole Schütt
0dfeee1108 Drop support for NDEBUG 2023-12-15 15:31:33 +01:00
Ole Schütt
71ab6edeee precommit: Fix Python 3.6 incompatibility 2023-11-24 15:37:50 +01:00
Ole Schütt
4bf43545bd Manula: Add precommit check for biblio refs 2023-11-21 18:05:00 +01:00
Ole Schütt
f8667229bc Fix Python 3.12 warnings 2023-11-04 14:30:06 +01:00
Ole Schuett
7c90856a67 Add precommit check for spaces in multi-line strings 2023-10-02 21:47:59 +02:00
Taillefumier Mathieu
3b45327215
offload: Only set LimitMallocHeapSize for HIP_VERSION > 5.2 2023-07-24 12:33:04 +02:00
Hans Pabst
03f49e929a LIBXSMM 2.0: ensure compatibility
* Link explicitly against static libraries.
* Dispatch kernel using v2-API.
2023-06-07 16:42:49 +02:00
Matthias Krack
40dbbd6d86 Allow tab characters also in arch files 2023-03-07 13:40:41 +01:00
Frederick Stein
6a8dd724d9 Refactor and simplify 2023-02-06 15:23:23 +01:00
Ole Schütt
64a6e2ead2 Update cp2k_info.F to 2023 2023-01-01 14:08:47 +01:00
Ole Schütt
ffbd2cdb7f precommit: Check copyright banner in LICENSE files 2023-01-01 13:01:39 +01:00