From d4eda79930684bac35908c470fea36bd2a972a2c Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 24 Jun 2025 12:28:58 -0700 Subject: [PATCH 1/6] build(language-support): add HAVE_CRITICAL macro When undefined or 0, this macro removes `critical` and `end critical` statements to work around a lack of support with a given compiler. --- include/language-support.F90 | 9 +++++++++ test/subdomain_test_m.F90 | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/include/language-support.F90 b/include/language-support.F90 index e787f378..45edbefb 100644 --- a/include/language-support.F90 +++ b/include/language-support.F90 @@ -12,6 +12,15 @@ #endif #endif +#ifndef HAVE_CRITICAL + ! Define whether the compiler supports the `critical` and `end critical` statements +# if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__GFORTRAN__) +# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1 +# else +# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 +# endif +#endif + #ifndef HAVE_MULTI_IMAGE_SUPPORT ! Define whether the compiler supports the statements and intrinsic procedures that support ! multi-image execution, e.g., this_image(), sync all, etc. diff --git a/test/subdomain_test_m.F90 b/test/subdomain_test_m.F90 index b15a5bec..e2e0c2fc 100644 --- a/test/subdomain_test_m.F90 +++ b/test/subdomain_test_m.F90 @@ -1,5 +1,8 @@ ! Copyright (c), The Regents of the University of California ! Terms of use are as specified in LICENSE.txt + +#include "language-support.F90" + module subdomain_test_m !! Define subdomain tests and procedures required for reporting results use julienne_m, only : & @@ -38,7 +41,7 @@ function results() result(test_results) test_descriptions = [ & test_description_t("computing a concave Laplacian for a spatially constant operand with a step down at boundaries", concave_laplacian) & ,test_description_t("reaching the correct steady state solution", correct_steady_state) & - ,test_description_t("functional pattern results matching procedural results" functional_matches_procedural) & + ,test_description_t("functional pattern results matching procedural results", functional_matches_procedural) & ] #else procedure(diagnosis_function_i), pointer :: & @@ -63,13 +66,17 @@ subroutine output(v) real, intent(in) :: v(:,:,:) integer j, k sync all +#ifdef HAVE_CRITICAL critical +#endif do j = 1, size(v,2) do k = 1, size(v,3) print *,"image ",this_image(),": ",j,k,v(:,j,k) end do end do +#ifdef HAVE_CRITICAL end critical +#endif sync all end subroutine From 2ea8db63ace2981478122a342326e136c9690630 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 24 Jun 2025 13:27:06 -0700 Subject: [PATCH 2/6] build(sourcery): rm dependence on sourcery library This commit replaces all uses of sourcery's data_partiotion_t type with julienne's bin_t type and removes sourcery as a dependency. --- src/matcha/subdomain_s.F90 | 9 ++++----- src/matcha_s.F90 | 9 ++++----- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/matcha/subdomain_s.F90 b/src/matcha/subdomain_s.F90 index 9889d210..28eaa930 100644 --- a/src/matcha/subdomain_s.F90 +++ b/src/matcha/subdomain_s.F90 @@ -5,15 +5,13 @@ submodule(subdomain_m) subdomain_s use assert_m - use sourcery_m, only : data_partition_t + use julienne_m, only : bin_t use intrinsic_array_m, only : intrinsic_array_t implicit none real, allocatable :: halo_x(:,:,:)[:] integer, parameter :: west=1, east=2 - type(data_partition_t) data_partition - real dx_, dy_, dz_ integer my_nx, nx, ny, nz, me, num_subdomains, my_internal_west, my_internal_east real, allocatable :: increment(:,:,:) @@ -44,8 +42,9 @@ me = this_image() num_subdomains = num_images() - call data_partition%define_partitions(nx) - my_nx = data_partition%last(me) - data_partition%first(me) + 1 + associate(bin => bin_t(num_items=nx, num_bins=num_subdomains, bin_number=me)) + my_nx = bin%last() - bin%first() + 1 + end associate if (allocated(self%s_)) deallocate(self%s_) allocate(self%s_(my_nx, ny, nz)) diff --git a/src/matcha_s.F90 b/src/matcha_s.F90 index 4735efc2..a4f9dabf 100644 --- a/src/matcha_s.F90 +++ b/src/matcha_s.F90 @@ -3,7 +3,7 @@ submodule(matcha_m) matcha_s use t_cell_collection_m, only : t_cell_collection_t use distribution_m, only : distribution_t - use sourcery_m, only : data_partition_t + use julienne_m, only : bin_t implicit none contains @@ -25,12 +25,10 @@ type(distribution_t) distribution integer, parameter :: nveldim = 4 integer step - type(data_partition_t) data_partition - call data_partition%define_partitions(cardinality=ncells) - associate(me => this_image()) - associate(my_num_cells => data_partition%last(me) - data_partition%first(me) + 1) + associate(bin => bin_t(num_items=ncells, num_bins=num_images(), bin_number=me)) + associate(my_num_cells => bin%last() - bin%first() + 1) call random_init(repeatable=.true., image_distinct=.true.) @@ -55,6 +53,7 @@ end associate end associate end associate + end associate end associate end block end associate From 1c6b5ca47fabd76c0d5a9722bd74625c9415b87f Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 24 Jun 2025 13:29:32 -0700 Subject: [PATCH 3/6] build(fpm): simplify manifest, update julienne This commit 1. Removes unnecessary information from the fpm.toml file, including removing the depenence on sourcery, which provided a capability that is at least partially redundant with a similar capability in julienne and 2. Updates the julienne dependency to version 2.3.0. --- fpm.toml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/fpm.toml b/fpm.toml index 3a806d20..b0d4802b 100644 --- a/fpm.toml +++ b/fpm.toml @@ -1,10 +1,5 @@ name = "matcha" -version = "0.1.0" -license = "see LICENSE.txt" -author = "Damian Rouson, David Torres, Dominick Martinez, Jeremiah Bailey, and Brad Richardson" -maintainer = "rouson@lbl.gov" [dependencies] assert = {git = "https://github.com/berkeleylab/assert", tag = "2.1.0"} -julienne = {git = "https://github.com/BerkeleyLab/julienne", tag = "2.0.0"} -sourcery = {git = "https://github.com/sourceryinstitute/sourcery", tag = "4.5.1"} +julienne = {git = "https://github.com/BerkeleyLab/julienne", tag = "2.3.0"} From b298a046d9c8aeebbf0d89577fdb1e157248cb6f Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 24 Jun 2025 18:38:45 -0700 Subject: [PATCH 4/6] test(CI): update to GCC 15 --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 841a3cbe..db9ca925 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,7 +8,7 @@ jobs: env: FC: gfortran - GCC_V: 14 + GCC_V: 15 steps: - name: Checkout code From 8f7087f25faa2e49a932a38509a6e73d6a83a63b Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 24 Jun 2025 18:48:03 -0700 Subject: [PATCH 5/6] test(CI): switch back to GCC 14 GitHub doesn't yet have GCC 15. --- .github/workflows/CI.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index db9ca925..841a3cbe 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -8,7 +8,7 @@ jobs: env: FC: gfortran - GCC_V: 15 + GCC_V: 14 steps: - name: Checkout code From fbf5dd8519e1ccf0d54cffed53728bfd9efbfcd5 Mon Sep 17 00:00:00 2001 From: Damian Rouson Date: Tue, 24 Jun 2025 18:48:47 -0700 Subject: [PATCH 6/6] fix(language-support): copypasta --- include/language-support.F90 | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/include/language-support.F90 b/include/language-support.F90 index 45edbefb..b85b1de7 100644 --- a/include/language-support.F90 +++ b/include/language-support.F90 @@ -5,28 +5,28 @@ ! Define whether the compiler supports associating a procedure pointer dummy argument with an ! actual argument that is a valid target for the pointer dummy in a procedure assignment, a ! feature introduced in Fortran 2008 and described in Fortran 2023 clause 15.5.2.10 paragraph 5. -#if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__flang__) -#define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1 -#else -#define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 -#endif +# if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__flang__) +# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1 +# else +# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 +# endif #endif #ifndef HAVE_CRITICAL - ! Define whether the compiler supports the `critical` and `end critical` statements + ! Define whether the compiler supports the `critical` and `end critical` statements # if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__GFORTRAN__) -# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 1 +# define HAVE_CRITICAL 1 # else -# define HAVE_PROCEDURE_ACTUAL_FOR_POINTER_DUMMY 0 +# define HAVE_CRITICAL 0 # endif #endif #ifndef HAVE_MULTI_IMAGE_SUPPORT ! Define whether the compiler supports the statements and intrinsic procedures that support ! multi-image execution, e.g., this_image(), sync all, etc. -#if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__GFORTRAN__) -#define HAVE_MULTI_IMAGE_SUPPORT 1 -#else -#define HAVE_MULTI_IMAGE_SUPPORT 0 -#endif +# if defined(_CRAYFTN) || defined(__INTEL_COMPILER) || defined(NAGFOR) || defined(__GFORTRAN__) +# define HAVE_MULTI_IMAGE_SUPPORT 1 +# else +# define HAVE_MULTI_IMAGE_SUPPORT 0 +# endif #endif