From 7722251579b60cab187629a48801f65d893ac9d7 Mon Sep 17 00:00:00 2001 From: Katherine Rasmussen Date: Tue, 12 Dec 2023 10:53:27 -0800 Subject: [PATCH] Update `prif_caffeinate` to `prif_init` and remove `prif_decaffeinate` --- example/hello.f90 | 4 ++-- example/support-test/error_stop_character_code.f90 | 4 ++-- example/support-test/error_stop_integer_code.f90 | 4 ++-- example/support-test/stop_with_integer_code.f90 | 4 ++-- example/support-test/stop_with_no_code.f90 | 4 ++-- ...ate_decaffeinate_m.f90 => program_startup_m.f90} | 13 ++++--------- ...ate_decaffeinate_s.F90 => program_startup_s.F90} | 10 +++------- src/prif.f90 | 2 +- test/a00_caffeinate_test.f90 | 4 ++-- 9 files changed, 20 insertions(+), 29 deletions(-) rename src/caffeine/{caffeinate_decaffeinate_m.f90 => program_startup_m.f90} (50%) rename src/caffeine/{caffeinate_decaffeinate_s.F90 => program_startup_s.F90} (85%) diff --git a/example/hello.f90 b/example/hello.f90 index 12df952b4..573ddba99 100644 --- a/example/hello.f90 +++ b/example/hello.f90 @@ -1,8 +1,8 @@ program hello_world - use prif, only : prif_caffeinate, this_image => prif_this_image, num_images => prif_num_images, prif_stop + use prif, only : prif_init, this_image => prif_this_image, num_images => prif_num_images, prif_stop implicit none - if (prif_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit code" + if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit code" print *, "Hello from image", this_image(), "of", num_images() diff --git a/example/support-test/error_stop_character_code.f90 b/example/support-test/error_stop_character_code.f90 index 5840c89d6..c100b5914 100644 --- a/example/support-test/error_stop_character_code.f90 +++ b/example/support-test/error_stop_character_code.f90 @@ -1,8 +1,8 @@ program error_stop_character_code - use prif, only : prif_caffeinate, prif_error_stop + use prif, only : prif_init, prif_error_stop implicit none - if (prif_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code" + if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code" call prif_error_stop("Oh snap!") diff --git a/example/support-test/error_stop_integer_code.f90 b/example/support-test/error_stop_integer_code.f90 index 679876b24..01d5ebd51 100644 --- a/example/support-test/error_stop_integer_code.f90 +++ b/example/support-test/error_stop_integer_code.f90 @@ -1,8 +1,8 @@ program error_stop_integer_code - use prif, only : prif_caffeinate, prif_error_stop + use prif, only : prif_init, prif_error_stop implicit none - if (prif_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code" + if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code" call prif_error_stop(1) diff --git a/example/support-test/stop_with_integer_code.f90 b/example/support-test/stop_with_integer_code.f90 index b0578ba7a..9b87c4949 100644 --- a/example/support-test/stop_with_integer_code.f90 +++ b/example/support-test/stop_with_integer_code.f90 @@ -1,8 +1,8 @@ program stop_with_no_code - use prif, only : prif_caffeinate, prif_stop + use prif, only : prif_init, prif_stop implicit none - if (prif_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code" + if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code" call prif_stop(1) diff --git a/example/support-test/stop_with_no_code.f90 b/example/support-test/stop_with_no_code.f90 index 1e14214b2..718a406bb 100644 --- a/example/support-test/stop_with_no_code.f90 +++ b/example/support-test/stop_with_no_code.f90 @@ -1,8 +1,8 @@ program stop_with_no_code - use prif, only : prif_caffeinate, prif_stop + use prif, only : prif_init, prif_stop implicit none - if (prif_caffeinate() /= 0) error stop "caffeinate returned a non-zero exit_code" + if (prif_init() /= 0) error stop "caffeinate returned a non-zero exit_code" call prif_stop diff --git a/src/caffeine/caffeinate_decaffeinate_m.f90 b/src/caffeine/program_startup_m.f90 similarity index 50% rename from src/caffeine/caffeinate_decaffeinate_m.f90 rename to src/caffeine/program_startup_m.f90 index 6b4c6c457..b1010c7e7 100644 --- a/src/caffeine/caffeinate_decaffeinate_m.f90 +++ b/src/caffeine/program_startup_m.f90 @@ -1,26 +1,21 @@ ! Copyright (c), The Regents of the University of California ! Terms of use are as specified in LICENSE.txt -module caffeinate_decaffeinate_m +module program_startup_m use team_type_m, only: prif_team_type implicit none private - public :: prif_caffeinate, prif_decaffeinate, default_team + public :: prif_init, default_team type(prif_team_type), target :: default_team interface - module function prif_caffeinate() result(exit_code) + module function prif_init() result(exit_code) implicit none integer exit_code end function - module subroutine prif_decaffeinate(exit_code) - implicit none - integer, intent(in) :: exit_code - end subroutine - end interface -end module caffeinate_decaffeinate_m +end module program_startup_m diff --git a/src/caffeine/caffeinate_decaffeinate_s.F90 b/src/caffeine/program_startup_s.F90 similarity index 85% rename from src/caffeine/caffeinate_decaffeinate_s.F90 rename to src/caffeine/program_startup_s.F90 index 4db58f274..69db1d3e6 100644 --- a/src/caffeine/caffeinate_decaffeinate_s.F90 +++ b/src/caffeine/program_startup_s.F90 @@ -1,6 +1,6 @@ ! Copyright (c), The Regents of the University of California ! Terms of use are as specified in LICENSE.txt -submodule(caffeinate_decaffeinate_m) caffeinate_decaffeinate_s +submodule(program_startup_m) program_startup_s use iso_c_binding, only : c_int, c_loc, c_char, c_null_char use synchronization_m, only : prif_sync_all use caffeine_h_m, only : caf_caffeinate, caf_decaffeinate @@ -9,7 +9,7 @@ contains - module procedure prif_caffeinate + module procedure prif_init integer i integer, parameter :: max_arg_len = 1024 @@ -45,8 +45,4 @@ function c_interop_arg(argnum) result(arg) end procedure - module procedure prif_decaffeinate - call caf_decaffeinate(exit_code) - end procedure - -end submodule caffeinate_decaffeinate_s +end submodule program_startup_s diff --git a/src/prif.f90 b/src/prif.f90 index 42466b29d..aa3a689d0 100644 --- a/src/prif.f90 +++ b/src/prif.f90 @@ -1,10 +1,10 @@ ! Copyright (c), The Regents of the University of California ! Terms of use are as specified in LICENSE.txt module prif + use program_startup_m, only : prif_init use program_termination_m, only : prif_stop, prif_error_stop use image_enumeration_m, only : prif_this_image, prif_num_images use collective_subroutines_m, only : prif_co_sum, prif_co_max, prif_co_min, prif_co_reduce, prif_co_broadcast - use caffeinate_decaffeinate_m, only : prif_caffeinate, prif_decaffeinate use team_type_m, only: prif_form_team, prif_change_team, prif_end_team, prif_team_type use synchronization_m, only : prif_sync_all implicit none diff --git a/test/a00_caffeinate_test.f90 b/test/a00_caffeinate_test.f90 index d043c1a66..a63a5156f 100644 --- a/test/a00_caffeinate_test.f90 +++ b/test/a00_caffeinate_test.f90 @@ -1,5 +1,5 @@ module a00_caffeinate_test - use caffeinate_decaffeinate_m, only : prif_caffeinate + use program_startup_m, only : prif_init use veggies, only: test_item_t, describe, result_t, it, assert_that implicit none @@ -22,7 +22,7 @@ function check_caffeination() result(result_) integer, parameter :: successful_initiation = 0 - result_ = assert_that(prif_caffeinate() == successful_initiation) + result_ = assert_that(prif_init() == successful_initiation) end function end module a00_caffeinate_test