Files
TheRock/rocm-systems/projects/rocprofiler-systems/examples/hpc/jacobi-fortran-usm/input.f90
T
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

87 lines
2.5 KiB
Fortran

module input_mod
use, intrinsic :: ISO_Fortran_env, only: stdout=>output_unit, stderr=>error_unit
use kind_mod
use mesh_mod, only: mesh_t, init_mesh
implicit none
!$omp requires unified_shared_memory
private
public :: debug, parse_arguments
logical :: debug
character(len=4) :: debug_string
integer(IK), parameter :: default_domain_size = 4096
contains
subroutine parse_arguments(mesh)
type(mesh_t), intent(out) :: mesh
integer(IK) :: argc, n_x, n_y
character(len=:), allocatable :: arg
argc = command_argument_count()
select case(argc)
case (0)
call init_mesh(mesh,default_domain_size,default_domain_size)
case (1)
call print_help_and_exit()
case (2)
select case(get_argument(1))
case ('-m','--mesh')
arg = get_argument(2)
read(arg,*) n_x
call init_mesh(mesh,n_x,n_x)
case default
call print_help_and_exit()
end select
case (3)
select case(get_argument(1))
case ('-m','--mesh')
arg = get_argument(2)
read(arg,*) n_x
arg = get_argument(3)
read(arg,*) n_y
call init_mesh(mesh,n_x,n_y)
case default
call print_help_and_exit()
end select
case default
call print_help_and_exit()
end select
call get_environment_variable("JACOBI_DEBUG", value=debug_string)
select case(trim(debug_string))
case ("TRUE","true","True","1")
debug = .true.
case default
debug = .false.
end select
end subroutine parse_arguments
function get_argument(n) result(arg)
integer(IK), intent(in) :: n
character(len=:), allocatable :: arg
integer(IK) :: len
call get_command_argument(n, length=len)
allocate(character(len) :: arg)
call get_command_argument(n,arg)
if ( arg.eq.'-h'.or.arg.eq.'--help') call print_help_and_exit()
end function get_argument
subroutine print_help_and_exit()
character(len=:), allocatable :: program_name
program_name = get_argument(0)
write(stderr,*) 'Usage: ',program_name,' [-m Mesh.X [Mesh.Y]] [-h | --help]'
write(stderr,*) ' -m | --mesh Mesh.x [Mesh.y]: set the domain size per node'
write(stderr,*) ' (if "Mesh.y" is missing, the domain size will default to (Mesh.x, Mesh.x);'
write(stderr,*) ' Mesh.x and Mesh.y must be positive integers)'
write(stderr,*) ' -h | --help: print help information'
error stop 1
end subroutine print_help_and_exit
end module input_mod