Skip to content

Commit

Permalink
precommit: Upgrade to Ubuntu 24.04
Browse files Browse the repository at this point in the history
  • Loading branch information
oschuett committed May 1, 2024
1 parent 2872709 commit 4dbdcdf
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 55 deletions.
2 changes: 1 addition & 1 deletion src/dbm/dbm_mpi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion src/dbm/dbm_multiply.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dbm/dbm_multiply_cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#if defined(__LIBXSMM)
#include <libxsmm.h>
#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
Expand Down
6 changes: 3 additions & 3 deletions src/dbm/dbm_multiply_opencl.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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))

Expand Down Expand Up @@ -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); \
} \
} \
} \
Expand Down Expand Up @@ -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);
Expand Down
32 changes: 14 additions & 18 deletions src/grid/cpu/grid_cpu_collint.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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];

Expand Down
2 changes: 1 addition & 1 deletion src/grid/cpu/grid_cpu_task_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions src/grid/dgemm/grid_dgemm_collocate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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];
Expand Down Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions src/grid/dgemm/grid_dgemm_integrate.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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,
Expand Down
22 changes: 11 additions & 11 deletions src/grid/dgemm/grid_dgemm_non_orthorombic_corrections.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand All @@ -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];
Expand All @@ -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];
Expand All @@ -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];
Expand All @@ -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;
Expand All @@ -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];
Expand All @@ -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];
Expand All @@ -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];
Expand All @@ -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;
Expand All @@ -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];
Expand Down
9 changes: 5 additions & 4 deletions src/grid/dgemm/grid_dgemm_tensor_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions src/grid/dgemm/grid_dgemm_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand All @@ -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];
Expand Down
2 changes: 1 addition & 1 deletion src/grid/hip/grid_hip_integrate.cu
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/grid/ref/grid_ref_task_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/offload/offload_runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion tools/docker/Dockerfile.test_precommit
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/docker/generate_dockerfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tools/precommit/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu:22.04
FROM ubuntu:24.04

# author: Ole Schuett

Expand Down

0 comments on commit 4dbdcdf

Please sign in to comment.