Skip to content

Add CP2K grid integration benchmark#10

Merged
ThrudPrimrose merged 9 commits into
mainfrom
cp2k-macos
Jul 24, 2026
Merged

Add CP2K grid integration benchmark#10
ThrudPrimrose merged 9 commits into
mainfrom
cp2k-macos

Conversation

@guanLeTea

@guanLeTea guanLeTea commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

This PR adds two standalone CP2K benchmarks extracted from production code.

Included:
• CP2K Grid Integration (Level 2)

  • NumPy implementation
  • YAML manifest
  • Standalone Fortran reference
  • Local pytest suite

• CP2K TRS4 Density Matrix Purification (Level 3)

  • NumPy implementation
  • YAML manifest
  • Standalone Fortran reference
  • Local pytest suite
  • Naive single-node blocked CSR implementation replacing the DBCSR matrix multiplication

Validation:

  • Standalone benchmark test suites pass.
  • End-to-end numerical validation passes for C, C++, Fortran, and Numba.

@ThrudPrimrose
ThrudPrimrose self-requested a review July 23, 2026 10:07
npts: 18
seed: 17
XL:
num_tasks: 8192

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the work size on XL?

I think "seed" is not a size parameter but a config parameter, shouldn't it go to configs? I assume seed is random seet?

from numpy.ctypeslib import ndpointer
import pytest

HERE = Path(__file__).resolve().parent

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not need sys.path insert.

The folder should be added to repo via init.py

Also the test should be moved to the top level tests folder, You import the sources from tests folder

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Fortran source we need to have a path - move that closer to it


RTOL = 3.0e-13
ATOL = 3.0e-13
FORTRAN_SOURCE = HERE.parent / "cp2k_density_matrix_trs4_original.f90"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Fortran source we need to have a path yes.

STATE_SIZE, blocked_csr_multiply, cp2k_density_matrix_trs4,
)

RTOL = 3.0e-13

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

RTOL and ATOL are global constants in this repo, read it from the repo config

spin_scale: 2.0
seed: 19
XL:
n_block_rows: 192

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should try to aim to have a working set size of around at-least 4GB for problems, have you checked it.

Also parameters are the parameters that are required for allocating arrays and sizes.
Configuration parameters such as seed, eps_in, eps_max, threshold should go to the config. Those parameters can't be fuzzed and thus it will create problems when running, this is important!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I think I also ensure the fuzzing is more robust by reading array shapes

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still, move config paramters (the ones that are constant across shape parameters) to config.

@ThrudPrimrose
ThrudPrimrose merged commit 9e3e325 into main Jul 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants