Skip to content

Commit

Permalink
Update prif_caffeinate to prif_init and remove prif_decaffeinate
Browse files Browse the repository at this point in the history
  • Loading branch information
ktras committed Dec 12, 2023
1 parent a7ca559 commit 7722251
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 29 deletions.
4 changes: 2 additions & 2 deletions example/hello.f90
Original file line number Diff line number Diff line change
@@ -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()

Expand Down
4 changes: 2 additions & 2 deletions example/support-test/error_stop_character_code.f90
Original file line number Diff line number Diff line change
@@ -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!")

Expand Down
4 changes: 2 additions & 2 deletions example/support-test/error_stop_integer_code.f90
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 2 additions & 2 deletions example/support-test/stop_with_integer_code.f90
Original file line number Diff line number Diff line change
@@ -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)

Expand Down
4 changes: 2 additions & 2 deletions example/support-test/stop_with_no_code.f90
Original file line number Diff line number Diff line change
@@ -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

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,7 +9,7 @@

contains

module procedure prif_caffeinate
module procedure prif_init

integer i
integer, parameter :: max_arg_len = 1024
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/prif.f90
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 2 additions & 2 deletions test/a00_caffeinate_test.f90
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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

0 comments on commit 7722251

Please sign in to comment.