From 4dbdcdf615f67119c973549634dd4fbaed1f935a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Sch=C3=BCtt?= Date: Wed, 1 May 2024 16:09:41 +0200 Subject: [PATCH] precommit: Upgrade to Ubuntu 24.04 --- src/dbm/dbm_mpi.c | 2 +- src/dbm/dbm_multiply.c | 2 +- src/dbm/dbm_multiply_cpu.c | 2 +- src/dbm/dbm_multiply_opencl.cl | 6 ++-- src/grid/cpu/grid_cpu_collint.h | 32 ++++++++----------- src/grid/cpu/grid_cpu_task_list.c | 2 +- src/grid/dgemm/grid_dgemm_collocate.c | 6 ++-- src/grid/dgemm/grid_dgemm_integrate.c | 4 +-- .../grid_dgemm_non_orthorombic_corrections.c | 22 ++++++------- src/grid/dgemm/grid_dgemm_tensor_local.h | 9 +++--- src/grid/dgemm/grid_dgemm_utils.c | 6 ++-- src/grid/hip/grid_hip_integrate.cu | 2 +- src/grid/ref/grid_ref_task_list.c | 2 +- src/offload/offload_runtime.h | 4 +-- tools/docker/Dockerfile.test_precommit | 2 +- tools/docker/generate_dockerfiles.py | 2 +- tools/precommit/Dockerfile | 2 +- 17 files changed, 52 insertions(+), 55 deletions(-) diff --git a/src/dbm/dbm_mpi.c b/src/dbm/dbm_mpi.c index a1a4fbe5ac..a4fba5b531 100644 --- a/src/dbm/dbm_mpi.c +++ b/src/dbm/dbm_mpi.c @@ -210,7 +210,7 @@ void dbm_mpi_comm_free(dbm_mpi_comm_t *comm) { #if defined(__parallel) CHECK(MPI_Comm_free(comm)); #else - (void)comm; // mark used + (void)comm; // mark used #endif } diff --git a/src/dbm/dbm_multiply.c b/src/dbm/dbm_multiply.c index b042385d17..cdb9c4d8b2 100644 --- a/src/dbm/dbm_multiply.c +++ b/src/dbm/dbm_multiply.c @@ -113,7 +113,7 @@ static void backend_upload_packs(const dbm_pack_t *pack_a, #if defined(__OFFLOAD) && !defined(__NO_OFFLOAD_DBM) dbm_multiply_gpu_upload_packs(pack_a, pack_b, &ctx->gpu); #else - (void)pack_a; // mark as used + (void)pack_a; // mark as used (void)pack_b; (void)ctx; #endif diff --git a/src/dbm/dbm_multiply_cpu.c b/src/dbm/dbm_multiply_cpu.c index 01e035f35b..6c67ce336d 100644 --- a/src/dbm/dbm_multiply_cpu.c +++ b/src/dbm/dbm_multiply_cpu.c @@ -12,7 +12,7 @@ #if defined(__LIBXSMM) #include #if !defined(DBM_LIBXSMM_PREFETCH) -//#define DBM_LIBXSMM_PREFETCH LIBXSMM_GEMM_PREFETCH_AL2_AHEAD +// #define DBM_LIBXSMM_PREFETCH LIBXSMM_GEMM_PREFETCH_AL2_AHEAD #define DBM_LIBXSMM_PREFETCH LIBXSMM_GEMM_PREFETCH_NONE #endif #if LIBXSMM_VERSION4(1, 17, 0, 3710) > LIBXSMM_VERSION_NUMBER diff --git a/src/dbm/dbm_multiply_opencl.cl b/src/dbm/dbm_multiply_opencl.cl index c192055725..96ff82f71a 100644 --- a/src/dbm/dbm_multiply_opencl.cl +++ b/src/dbm/dbm_multiply_opencl.cl @@ -21,7 +21,7 @@ #define SINT short -#define DIVUP(A, B) (((A) + (B)-1) / (B)) +#define DIVUP(A, B) (((A) + (B) - 1) / (B)) #define NUP(N, UP) (DIVUP(N, UP) * (UP)) #define BLR(N, BN) (NUP(N, BN) - (N)) @@ -68,7 +68,7 @@ const SINT m = m0 + x, n = n0 + y; \ if (m < XM(TASK) && n < XN(TASK)) { \ const int idx = IDT(m, n, XM(TASK), XN(TASK)); \ - ACCUMULATE((CMAT) + XC(TASK) + idx, (ALPHA)*r); \ + ACCUMULATE((CMAT) + XC(TASK) + idx, (ALPHA) * r); \ } \ } \ } \ @@ -186,7 +186,7 @@ dbm_multiply(double alpha, int itask, int ntasks, int size, const int max_m = size / ntasks, tid = i / max_m; const SINT m = i - tid * max_m; global const dbm_task_t *const task = &tasks[itask + tid]; - if (m < XM(task)) { /* valid task */ + if (m < XM(task)) { /* valid task */ #if defined(BCST_WG) if (XM(task) <= XN(task)) { /* BCST_WG to broadcast B-values */ DBM_MULTIPLY(alpha, task, amat, bmat, cmat, m, BN, BCST_WG); diff --git a/src/grid/cpu/grid_cpu_collint.h b/src/grid/cpu/grid_cpu_collint.h index b5a4937887..08d5e3c792 100644 --- a/src/grid/cpu/grid_cpu_collint.h +++ b/src/grid/cpu/grid_cpu_collint.h @@ -249,15 +249,13 @@ ortho_cxy_to_cx(const int lp, const int j1, const int j2, const int cmax, * \brief Loop body of ortho_cxy_to_grid to be inlined for low values of lp. * \author Ole Schuett ******************************************************************************/ -static inline void __attribute__((always_inline)) -ortho_cxy_to_grid_low(const int lp, const int j1, const int j2, const int kg1, - const int kg2, const int jg1, const int jg2, - const int cmax, const double pol[3][lp + 1][2 * cmax + 1], - const int map[3][2 * cmax + 1], - const int sections[3][2 * cmax + 1], - const int npts_local[3], int **sphere_bounds_iter, - double *cx, GRID_CONST_WHEN_COLLOCATE double *cxy, - GRID_CONST_WHEN_INTEGRATE double *grid) { +static inline void __attribute__((always_inline)) ortho_cxy_to_grid_low( + const int lp, const int j1, const int j2, const int kg1, const int kg2, + const int jg1, const int jg2, const int cmax, + const double pol[3][lp + 1][2 * cmax + 1], const int map[3][2 * cmax + 1], + const int sections[3][2 * cmax + 1], const int npts_local[3], + int **sphere_bounds_iter, double *cx, GRID_CONST_WHEN_COLLOCATE double *cxy, + GRID_CONST_WHEN_INTEGRATE double *grid) { #if (GRID_DO_COLLOCATE) // collocate @@ -499,15 +497,13 @@ ortho_cxyz_to_grid(const int lp, const double zetp, const double dh[3][3], * \brief Collocates coefficients C_i onto the grid for general case. * \author Ole Schuett ******************************************************************************/ -static inline void __attribute__((always_inline)) -general_ci_to_grid(const int lp, const int jg, const int kg, const int ismin, - const int ismax, const int npts_local[3], - const int index_min[3], const int index_max[3], - const int map_i[], const int sections_i[], - const double gp[3], const int k, const int j, - const double exp_ij[], const double exp_jk[], - const double exp_ki[], GRID_CONST_WHEN_COLLOCATE double *ci, - GRID_CONST_WHEN_INTEGRATE double *grid) { +static inline void __attribute__((always_inline)) general_ci_to_grid( + const int lp, const int jg, const int kg, const int ismin, const int ismax, + const int npts_local[3], const int index_min[3], const int index_max[3], + const int map_i[], const int sections_i[], const double gp[3], const int k, + const int j, const double exp_ij[], const double exp_jk[], + const double exp_ki[], GRID_CONST_WHEN_COLLOCATE double *ci, + GRID_CONST_WHEN_INTEGRATE double *grid) { const int base = kg * npts_local[1] * npts_local[0] + jg * npts_local[0]; diff --git a/src/grid/cpu/grid_cpu_task_list.c b/src/grid/cpu/grid_cpu_task_list.c index f4750ff64b..cf85749064 100644 --- a/src/grid/cpu/grid_cpu_task_list.c +++ b/src/grid/cpu/grid_cpu_task_list.c @@ -348,7 +348,7 @@ static void collocate_one_grid_level( /*grid=*/my_grid); } // end of task loop - } // end of block loop + } // end of block loop // While there should be an implicit barrier at the end of the block loop, this // explicit barrier eliminates occasional seg faults with icc compiled binaries. diff --git a/src/grid/dgemm/grid_dgemm_collocate.c b/src/grid/dgemm/grid_dgemm_collocate.c index 3b72882f6d..c4d2495d69 100644 --- a/src/grid/dgemm/grid_dgemm_collocate.c +++ b/src/grid/dgemm/grid_dgemm_collocate.c @@ -208,7 +208,7 @@ void grid_fill_pol_dgemm(const bool transpose, const double dr, double *__restrict__ poly = &idx2(pol, 1, 0); double *__restrict__ src1 = &idx2(pol, 0, 0); double *__restrict__ dst = &idx2(pol, 2, 0); - //#pragma omp simd linear(dst, src1, poly) simdlen(8) + // #pragma omp simd linear(dst, src1, poly) simdlen(8) GRID_PRAGMA_SIMD((dst, src1, poly), 8) for (int ig = 0; ig < (xmax - xmin + 1 + pol_offset); ig++) dst[ig] = src1[ig] * poly[ig] * poly[ig]; @@ -464,7 +464,7 @@ void collocate_l0(double *scratch, const double alpha, const bool orthogonal_xy, for (int y = 0; y < cube->size[1]; y++) { const double *__restrict src = &idx2(exp_xy[0], y, 0); double *__restrict dst = &scratch[y * cube->ld_]; - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= src[x]; @@ -1244,7 +1244,7 @@ void grid_dgemm_collocate_task_list(grid_dgemm_task_list *const ptr, assert(ctx->nlevels == nlevels); - //#pragma omp parallel for + // #pragma omp parallel for for (int level = 0; level < ctx->nlevels; level++) { const _layout *layout = &ctx->layouts[level]; set_grid_parameters(&ctx->grid[level], ctx->orthorhombic, diff --git a/src/grid/dgemm/grid_dgemm_integrate.c b/src/grid/dgemm/grid_dgemm_integrate.c index 1804cd6442..d194576987 100644 --- a/src/grid/dgemm/grid_dgemm_integrate.c +++ b/src/grid/dgemm/grid_dgemm_integrate.c @@ -223,7 +223,7 @@ void extract_cube_within_spherical_cutoff_generic( const int sizex = upper_corner[2] - lower_corner[2]; - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) for (int x = 0; x < sizex; x++) { dst[x] = src[x]; @@ -1075,7 +1075,7 @@ void grid_dgemm_integrate_task_list( if (ctx->scratch == NULL) ctx->scratch = malloc(hab_blocks->size * max_threads); - //#pragma omp parallel for + // #pragma omp parallel for for (int level = 0; level < ctx->nlevels; level++) { const _layout *layout = &ctx->layouts[level]; set_grid_parameters(&ctx->grid[level], ctx->orthorhombic, diff --git a/src/grid/dgemm/grid_dgemm_non_orthorombic_corrections.c b/src/grid/dgemm/grid_dgemm_non_orthorombic_corrections.c index e509bdc5a6..a6f60e78a5 100644 --- a/src/grid/dgemm/grid_dgemm_non_orthorombic_corrections.c +++ b/src/grid/dgemm/grid_dgemm_non_orthorombic_corrections.c @@ -232,7 +232,7 @@ void calculate_non_orthorombic_corrections_tensor_blocked( double *restrict dst = &idx2(exp_blocked, y2, 0); const double scal = x1[y_1 + y2] * c_exp_const; double *restrict src = &x2[x_1]; - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) for (int x3 = 0; x3 < block_size[d2]; x3++) { dst[x3] = scal * src[x3]; @@ -283,7 +283,7 @@ void apply_non_orthorombic_corrections(const bool plane[restrict 3], const double zy = idx3(Exp[0], 1, z, y); double *restrict dst = &idx3(cube[0], z, y, 0); - //#pragma omp simd linear(dst) simdlen(8) + // #pragma omp simd linear(dst) simdlen(8) GRID_PRAGMA_SIMD((dst), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= zy; @@ -299,7 +299,7 @@ void apply_non_orthorombic_corrections(const bool plane[restrict 3], double *restrict zx = &idx3(Exp[0], 0, z, 0); for (int y = 0; y < cube->size[1]; y++) { double *restrict dst = &idx3(cube[0], z, y, 0); - //#pragma omp simd linear(dst, zx) simdlen(8) + // #pragma omp simd linear(dst, zx) simdlen(8) GRID_PRAGMA_SIMD((dst, zx), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= zx[x]; @@ -317,7 +317,7 @@ void apply_non_orthorombic_corrections(const bool plane[restrict 3], double *restrict yx = &idx3(Exp[0], 2, y, 0); double *restrict dst = &idx3(cube[0], z, y, 0); - //#pragma omp simd linear(dst, yx) simdlen(8) + // #pragma omp simd linear(dst, yx) simdlen(8) GRID_PRAGMA_SIMD((dst, yx), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= zy * yx[x]; @@ -334,7 +334,7 @@ void apply_non_orthorombic_corrections(const bool plane[restrict 3], for (int y = 0; y < cube->size[1]; y++) { double *restrict yx = &idx3(Exp[0], 2, y, 0); double *restrict dst = &idx3(cube[0], z, y, 0); - //#pragma omp simd linear(dst, yx) simdlen(8) + // #pragma omp simd linear(dst, yx) simdlen(8) GRID_PRAGMA_SIMD((dst, yx), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= zx[x] * yx[x]; @@ -352,7 +352,7 @@ void apply_non_orthorombic_corrections(const bool plane[restrict 3], const double zy = idx3(Exp[0], 1, z, y); double *restrict dst = &idx3(cube[0], z, y, 0); - //#pragma omp simd linear(dst) simdlen(8) + // #pragma omp simd linear(dst) simdlen(8) GRID_PRAGMA_SIMD((dst), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= zx[x] * zy; @@ -371,7 +371,7 @@ void apply_non_orthorombic_corrections(const bool plane[restrict 3], const double *restrict yx = &idx3(Exp[0], 2, y, 0); double *restrict dst = &idx3(cube[0], z, y, 0); - //#pragma omp simd linear(dst, zx, yx) simdlen(8) + // #pragma omp simd linear(dst, zx, yx) simdlen(8) GRID_PRAGMA_SIMD((dst, zx), 8) for (int x = 0; x < cube->size[2]; x++) { dst[x] *= zx[x] * zy * yx[x]; @@ -388,7 +388,7 @@ void apply_non_orthorombic_corrections_xy_blocked( double *restrict dst = &idx3(m[0], gamma, y1, 0); double *restrict src = &idx2(Exp[0], y1, 0); - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) for (int x1 = 0; x1 < m->size[2]; x1++) { dst[x1] *= src[x1]; @@ -403,7 +403,7 @@ void apply_non_orthorombic_corrections_xz_blocked( double *restrict src = &idx2(Exp[0], z1, 0); for (int y1 = 0; y1 < m->size[1]; y1++) { double *restrict dst = &idx3(m[0], z1, y1, 0); - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) for (int x1 = 0; x1 < m->size[2]; x1++) { dst[x1] *= src[x1]; @@ -418,7 +418,7 @@ void apply_non_orthorombic_corrections_yz_blocked( for (int y1 = 0; y1 < m->size[1]; y1++) { const double src = idx2(Exp[0], z1, y1); double *restrict dst = &idx3(m[0], z1, y1, 0); - //#pragma omp simd linear(dst) simdlen(8) + // #pragma omp simd linear(dst) simdlen(8) GRID_PRAGMA_SIMD((dst), 8) for (int x1 = 0; x1 < m->size[2]; x1++) { dst[x1] *= src; @@ -435,7 +435,7 @@ void apply_non_orthorombic_corrections_xz_yz_blocked( for (int y1 = 0; y1 < m->size[1]; y1++) { const double src = idx2(Exp_yz[0], z1, y1); double *restrict dst = &idx3(m[0], z1, y1, 0); - //#pragma omp simd linear(dst) simdlen(8) + // #pragma omp simd linear(dst) simdlen(8) GRID_PRAGMA_SIMD((dst), 8) for (int x1 = 0; x1 < m->size[2]; x1++) { dst[x1] *= src * src_xz[x1]; diff --git a/src/grid/dgemm/grid_dgemm_tensor_local.h b/src/grid/dgemm/grid_dgemm_tensor_local.h index 03b08836ed..18cfb90b76 100644 --- a/src/grid/dgemm/grid_dgemm_tensor_local.h +++ b/src/grid/dgemm/grid_dgemm_tensor_local.h @@ -250,9 +250,10 @@ extern size_t realloc_tensor(tensor *t); extern void alloc_tensor(tensor *t); #define idx5(a, i, j, k, l, m) \ - a.data[(i)*a.offsets[0] + (j)*a.offsets[1] + (k)*a.offsets[2] + (l)*a.ld_ + m] + a.data[(i) * a.offsets[0] + (j) * a.offsets[1] + (k) * a.offsets[2] + \ + (l) * a.ld_ + m] #define idx4(a, i, j, k, l) \ - a.data[(i)*a.offsets[0] + (j)*a.offsets[1] + (k)*a.ld_ + (l)] -#define idx3(a, i, j, k) a.data[(i)*a.offsets[0] + (j)*a.ld_ + (k)] -#define idx2(a, i, j) a.data[(i)*a.ld_ + (j)] + a.data[(i) * a.offsets[0] + (j) * a.offsets[1] + (k) * a.ld_ + (l)] +#define idx3(a, i, j, k) a.data[(i) * a.offsets[0] + (j) * a.ld_ + (k)] +#define idx2(a, i, j) a.data[(i) * a.ld_ + (j)] #endif diff --git a/src/grid/dgemm/grid_dgemm_utils.c b/src/grid/dgemm/grid_dgemm_utils.c index 1c76b09df6..b64a4d29b6 100644 --- a/src/grid/dgemm/grid_dgemm_utils.c +++ b/src/grid/dgemm/grid_dgemm_utils.c @@ -211,7 +211,7 @@ void extract_sub_grid(const int *lower_corner, const int *upper_corner, #ifdef __LIBXSMM LIBXSMM_PRAGMA_SIMD #else - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) #endif for (int x = 0; x < sizex; x++) { @@ -247,7 +247,7 @@ void add_sub_grid(const int *lower_corner, const int *upper_corner, #ifdef __LIBXSMM LIBXSMM_PRAGMA_SIMD #else - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) #endif for (int x = 0; x < sizex; x++) { @@ -258,7 +258,7 @@ void add_sub_grid(const int *lower_corner, const int *upper_corner, src += subgrid->ld_; } - //#pragma omp simd linear(dst, src) simdlen(8) + // #pragma omp simd linear(dst, src) simdlen(8) GRID_PRAGMA_SIMD((dst, src), 8) for (int x = 0; x < sizex; x++) { dst[x] += src[x]; diff --git a/src/grid/hip/grid_hip_integrate.cu b/src/grid/hip/grid_hip_integrate.cu index bcb8555923..5cbabd6c5e 100644 --- a/src/grid/hip/grid_hip_integrate.cu +++ b/src/grid/hip/grid_hip_integrate.cu @@ -750,5 +750,5 @@ void context_info::compute_hab_coefficients() { this->main_stream>>>(params); } } -}; // namespace rocm_backend +}; // namespace rocm_backend #endif // defined(__OFFLOAD_HIP) && !defined(__NO_OFFLOAD_GRID) diff --git a/src/grid/ref/grid_ref_task_list.c b/src/grid/ref/grid_ref_task_list.c index 858b910ef9..0e462d4e65 100644 --- a/src/grid/ref/grid_ref_task_list.c +++ b/src/grid/ref/grid_ref_task_list.c @@ -348,7 +348,7 @@ static void collocate_one_grid_level( /*grid=*/my_grid); } // end of task loop - } // end of block loop + } // end of block loop // While there should be an implicit barrier at the end of the block loop, this // explicit barrier eliminates occasional seg faults with icc compiled binaries. diff --git a/src/offload/offload_runtime.h b/src/offload/offload_runtime.h index 51bbf39697..0679eeadcd 100644 --- a/src/offload/offload_runtime.h +++ b/src/offload/offload_runtime.h @@ -92,8 +92,8 @@ static inline const char *offloadGetErrorName(offloadError_t error) { #elif defined(__OFFLOAD_HIP) return hipGetErrorName(error); #elif defined(__OFFLOAD_OPENCL) - (void)error; /* mark used */ - return ""; /* TODO */ + (void)error; /* mark used */ + return ""; /* TODO */ #endif } diff --git a/tools/docker/Dockerfile.test_precommit b/tools/docker/Dockerfile.test_precommit index 278d0bb0f3..255d473e9d 100644 --- a/tools/docker/Dockerfile.test_precommit +++ b/tools/docker/Dockerfile.test_precommit @@ -3,7 +3,7 @@ # Usage: docker build -f ./Dockerfile.test_precommit ../../ # -FROM ubuntu:22.04 +FROM ubuntu:24.04 # Install dependencies. WORKDIR /opt/cp2k-precommit diff --git a/tools/docker/generate_dockerfiles.py b/tools/docker/generate_dockerfiles.py index ce853dd57f..54041a0e1c 100755 --- a/tools/docker/generate_dockerfiles.py +++ b/tools/docker/generate_dockerfiles.py @@ -265,7 +265,7 @@ def manual() -> str: def precommit() -> str: return ( rf""" -FROM ubuntu:22.04 +FROM ubuntu:24.04 # Install dependencies. WORKDIR /opt/cp2k-precommit diff --git a/tools/precommit/Dockerfile b/tools/precommit/Dockerfile index adebcba9d1..46f1e35989 100644 --- a/tools/precommit/Dockerfile +++ b/tools/precommit/Dockerfile @@ -1,4 +1,4 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 # author: Ole Schuett