Skip to content

CMake support#664

Merged
kostrzewa merged 41 commits intoetmc:masterfrom
mtaillefumier:cmake_support
Apr 2, 2026
Merged

CMake support#664
kostrzewa merged 41 commits intoetmc:masterfrom
mtaillefumier:cmake_support

Conversation

@mtaillefumier
Copy link
Copy Markdown
Contributor

@mtaillefumier mtaillefumier commented Feb 5, 2026

tmlQCD can be compiled with CMake. So far the build supports

  • QUDA (with all QUDA releated options)
  • CUDA
  • HIP
  • MPI
  • OpenMP
  • lime
  • lemon
  • hdf5
  • fftw
  • QphiX
  • lapack
  • DDalphaAMG
  • Rename DFLAGS with TM_USE_BLA
  • Vectorization alignment
  • Documentation
  • cleanup
  • ci/cd update
  • cscs ci/cd update
  • Remove TM_USE_QUDA_EXPERIMENTAL and TM_QUDA_FERMIONIC_FORCES #ifdef statements but not the code itself.
  • HIP_PATH HIP_ROOT
  • Add autodetection
  • Remove KOJAX
  • use fetch_content
  • remove bison
  • Rewrite the README.md
  • HIP+QUDA+tmLQCD
  • test compilation on beverin / AMD GPU (can be done separately, not cmake specific)

@mtaillefumier
Copy link
Copy Markdown
Contributor Author

@kostrzewa and @chaoos :

  • I reorganized the source tree and moved all library files in src/lib and executable in src/bin. Other layouts can be used
  • Compilation fails for some of the tests for instance test_locallity.c.

Comment thread cmake/git_hash.h.in Outdated
Comment thread cmake/tmlqcd_config_internal.h.in Outdated
Comment thread src/bin/tests/test_lemon.c
Comment thread profiling/hmc/example_profile.pdf
Comment thread CMakeLists.txt Outdated
@kostrzewa
Copy link
Copy Markdown
Member

@kottnad @chaoos in preparation for the discussion it would be great if you could give this a look and see if there are things where we should use the opportunity to do them differently

@mtaillefumier mtaillefumier force-pushed the cmake_support branch 3 times, most recently from 2d50b54 to 8f39dd2 Compare February 11, 2026 07:58
chaoos
chaoos previously requested changes Feb 11, 2026
Copy link
Copy Markdown
Contributor

@chaoos chaoos left a comment

Choose a reason for hiding this comment

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

Even with the changes from my suggestions below, the build still fails for me with various compiler errors and warnings, like e.g.:

/home/roman/projects/tmp/tmLQCD/src/lib/io/gauge_read_binary.c: In function ‘read_binary_gauge_data’:
/home/roman/projects/tmp/tmLQCD/src/lib/io/gauge_read_binary.c:72:17: error: ‘g_cart_grid’ undeclared (first use in this function); did you mean ‘g_cart_id’?
   72 |     MPI_Barrier(g_cart_grid);
      |                 ^~~~~~~~~~~
      |                 g_cart_id
/home/roman/projects/tmp/tmLQCD/src/lib/io/gauge_read_binary.c:72:17: note: each undeclared identifier is reported only once for each function it appears in
/home/roman/projects/tmp/tmLQCD/src/lib/io/utils_construct_writer.c: In function ‘construct_writer’:
/home/roman/projects/tmp/tmLQCD/src/lib/io/utils_construct_writer.c:17:28: error: ‘g_cart_grid’ undeclared (first use in this function); did you mean ‘g_cart_id’?
   17 |     status = MPI_File_open(g_cart_grid, filename,
      |                            ^~~~~~~~~~~
      |                            g_cart_id

One can put these variables as extern, but then at link time it fail to resolve with undefined reference to g_cart_grid'`.

Comment thread CMakeLists.txt Outdated
Comment thread src/lib/CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
@chaoos
Copy link
Copy Markdown
Contributor

chaoos commented Feb 12, 2026

Even with the changes from my suggestions below, the build still fails for me with various compiler errors and warnings, like e.g.:

/home/roman/projects/tmp/tmLQCD/src/lib/io/gauge_read_binary.c: In function ‘read_binary_gauge_data’:
/home/roman/projects/tmp/tmLQCD/src/lib/io/gauge_read_binary.c:72:17: error: ‘g_cart_grid’ undeclared (first use in this function); did you mean ‘g_cart_id’?
   72 |     MPI_Barrier(g_cart_grid);
      |                 ^~~~~~~~~~~
      |                 g_cart_id
/home/roman/projects/tmp/tmLQCD/src/lib/io/gauge_read_binary.c:72:17: note: each undeclared identifier is reported only once for each function it appears in
/home/roman/projects/tmp/tmLQCD/src/lib/io/utils_construct_writer.c: In function ‘construct_writer’:
/home/roman/projects/tmp/tmLQCD/src/lib/io/utils_construct_writer.c:17:28: error: ‘g_cart_grid’ undeclared (first use in this function); did you mean ‘g_cart_id’?
   17 |     status = MPI_File_open(g_cart_grid, filename,
      |                            ^~~~~~~~~~~
      |                            g_cart_id

One can put these variables as extern, but then at link time it fail to resolve with undefined reference to g_cart_grid'`.

Apologies, if I build lemon with the new cmake system as static library, I can build tmlqcd properly.

@mtaillefumier
Copy link
Copy Markdown
Contributor Author

mtaillefumier commented Feb 12, 2026

Sorry, the current version does not support the lemon configure build as the lemon cmake build system makes this more reliable. I need to check if I generate a pkg-config file for lemon

Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt
Comment thread CMakeLists.txt
endif()

# check for fftw3 (rely on pkgconfig).
if(TM_USE_FFTW)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kostrzewa check if FFTW still needed

Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
Comment thread CMakeLists.txt Outdated
@kostrzewa
Copy link
Copy Markdown
Member

remove LAPH_ev.c

Comment thread src/lib/CMakeLists.txt
set_target_properties(hmc PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1)

# define a library and add the dependencies
target_link_libraries(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@kostrzewa test if this works with CVC

Comment thread src/lib/CMakeLists.txt Outdated
@kostrzewa
Copy link
Copy Markdown
Member

please add a couple of example cmake calls to a doc/cmake-examples directory

@kostrzewa
Copy link
Copy Markdown
Member

cscs-ci run default

set version to 6.1.0
use back-ticks for closing code sections
@kostrzewa kostrzewa merged commit d2b1b3d into etmc:master Apr 2, 2026
@chaoos chaoos mentioned this pull request Apr 7, 2026
8 tasks
@mtaillefumier mtaillefumier deleted the cmake_support branch April 15, 2026 06:49
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.

3 participants