Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gyacomo
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Antoine Cyril David Hoffmann
Gyacomo
Commits
2799bb01
Commit
2799bb01
authored
4 years ago
by
Antoine Cyril David Hoffmann
Browse files
Options
Downloads
Patches
Plain Diff
Adaptation for 2D parallel runs with mpi along p and kr
parent
bd7c9676
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/basic_mod.F90
+9
-7
9 additions, 7 deletions
src/basic_mod.F90
src/ppinit.F90
+41
-62
41 additions, 62 deletions
src/ppinit.F90
with
50 additions
and
69 deletions
src/basic_mod.F90
+
9
−
7
View file @
2799bb01
...
@@ -10,10 +10,10 @@ MODULE basic
...
@@ -10,10 +10,10 @@ MODULE basic
real
(
dp
)
::
tmax
=
100000.0
! Maximum simulation time
real
(
dp
)
::
tmax
=
100000.0
! Maximum simulation time
real
(
dp
)
::
dt
=
1.0
! Time step
real
(
dp
)
::
dt
=
1.0
! Time step
real
(
dp
)
::
time
=
0
! Current simulation time (Init from restart file)
real
(
dp
)
::
time
=
0
! Current simulation time (Init from restart file)
INTEGER
::
comm0
! Default communicator with a topology
INTEGER
::
comm0
! Default communicator with a topology
INTEGER
::
commp
,
commr
! Communicators for 1-dim cartesian subgrids of comm0
INTEGER
::
commp
,
commr
! Communicators for 1-dim cartesian subgrids of comm0
INTEGER
::
jobnum
=
0
! Job number
INTEGER
::
jobnum
=
0
! Job number
INTEGER
::
step
=
0
! Calculation step of this run
INTEGER
::
step
=
0
! Calculation step of this run
INTEGER
::
cstep
=
0
! Current step number (Init from restart file)
INTEGER
::
cstep
=
0
! Current step number (Init from restart file)
...
@@ -24,8 +24,10 @@ MODULE basic
...
@@ -24,8 +24,10 @@ MODULE basic
INTEGER
::
ierr
! flag for MPI error
INTEGER
::
ierr
! flag for MPI error
INTEGER
::
my_id
! Rank in COMM_WORLD
INTEGER
::
my_id
! Rank in COMM_WORLD
INTEGER
::
num_procs
! number of MPI processes
INTEGER
::
num_procs
! number of MPI processes
INTEGER
::
ncp
,
ncr
! Number of processes in p and r
INTEGER
::
num_procs_p
,
num_procs_kr
! Number of processes in p and r
INTEGER
::
me_0
,
me_p
,
me_z
! Ranks in comm0, commp, commz
INTEGER
::
rank_0
,
rank_p
,
rank_r
! Ranks in comm0, commp, commr
INTEGER
::
nbr_L
,
nbr_R
! Left and right neighbours (along p)
INTEGER
::
nbr_T
,
nbr_B
! Top and bottom neighbours (along kr)
INTEGER
::
iframe1d
! counting the number of times 1d datasets are outputed (for diagnose)
INTEGER
::
iframe1d
! counting the number of times 1d datasets are outputed (for diagnose)
INTEGER
::
iframe2d
! counting the number of times 2d datasets are outputed (for diagnose)
INTEGER
::
iframe2d
! counting the number of times 2d datasets are outputed (for diagnose)
...
@@ -38,9 +40,9 @@ MODULE basic
...
@@ -38,9 +40,9 @@ MODULE basic
! To measure computation time
! To measure computation time
real
::
start
,
finish
real
::
start
,
finish
real
(
dp
)
::
t0_rhs
,
t0_adv_field
,
t0_poisson
,
t0_Sapj
,
t0_diag
,
t0_checkfield
,
t0_step
real
(
dp
)
::
t0_rhs
,
t0_adv_field
,
t0_poisson
,
t0_Sapj
,
t0_diag
,
t0_checkfield
,
t0_step
,
t0_comm
real
(
dp
)
::
t1_rhs
,
t1_adv_field
,
t1_poisson
,
t1_Sapj
,
t1_diag
,
t1_checkfield
,
t1_step
real
(
dp
)
::
t1_rhs
,
t1_adv_field
,
t1_poisson
,
t1_Sapj
,
t1_diag
,
t1_checkfield
,
t1_step
,
t1_comm
real
(
dp
)
::
tc_rhs
,
tc_adv_field
,
tc_poisson
,
tc_Sapj
,
tc_diag
,
tc_checkfield
,
tc_step
real
(
dp
)
::
tc_rhs
,
tc_adv_field
,
tc_poisson
,
tc_Sapj
,
tc_diag
,
tc_checkfield
,
tc_step
,
tc_comm
real
(
dp
)::
maxruntime
=
1e9
! Maximum simulation CPU time
real
(
dp
)::
maxruntime
=
1e9
! Maximum simulation CPU time
INTERFACE
allocate_array
INTERFACE
allocate_array
...
...
This diff is collapsed.
Click to expand it.
src/ppinit.F90
+
41
−
62
View file @
2799bb01
...
@@ -12,79 +12,58 @@ SUBROUTINE ppinit
...
@@ -12,79 +12,58 @@ SUBROUTINE ppinit
LOGICAL
::
periods
(
ndims
)
=
.FALSE.
,
reorder
=
.FALSE.
LOGICAL
::
periods
(
ndims
)
=
.FALSE.
,
reorder
=
.FALSE.
CHARACTER
(
len
=
32
)
::
str
CHARACTER
(
len
=
32
)
::
str
INTEGER
::
nargs
,
i
,
l
INTEGER
::
nargs
,
i
,
l
INTEGER
::
nghb_L
,
nghb_R
! Left and right neighbors along p
INTEGER
::
source
CALL
MPI_INIT
(
ierr
)
CALL
MPI_INIT
(
ierr
)
! CALL MPI_INIT_THREAD(MPI_THREAD_SINGLE,version_prov,ierr)
! CALL MPI_INIT_THREAD(MPI_THREAD_FUNNELED,version_prov,ierr)
CALL
MPI_COMM_RANK
(
MPI_COMM_WORLD
,
my_id
,
ierr
)
CALL
MPI_COMM_RANK
(
MPI_COMM_WORLD
,
my_id
,
ierr
)
CALL
MPI_COMM_SIZE
(
MPI_COMM_WORLD
,
num_procs
,
ierr
)
CALL
MPI_COMM_SIZE
(
MPI_COMM_WORLD
,
num_procs
,
ierr
)
! nargs = COMMAND_ARGUMENT_COUNT()
! IF( nargs .NE. 0 .AND. nargs .NE. ndims ) THEN
! IF(my_id .EQ. 0) WRITE(*, '(a,i4,a)') 'Number of arguments not equal to NDIMS =', ndims, '!'
! CALL MPI_ABORT(MPI_COMM_WORLD, -1, ierr)
! END IF
! !
! IF( nargs .NE. 0 ) THEN
! DO i=1,nargs
! CALL GET_COMMAND_ARGUMENT(i, str, l, ierr)
! READ(str(1:l),'(i3)') dims(i)
! ncp = dims(1) ! Number of processes along p
! ncr = dims(2) ! Number of processes along kr
! END DO
! IF( PRODUCT(dims) .NE. num_procs ) THEN
! IF(my_id .EQ. 0) WRITE(*, '(a,i4,a,i4)') 'Product of dims: ', PRODUCT(dims), " is not consistent WITH NPROCS=",num_procs
! CALL MPI_ABORT(MPI_COMM_WORLD, -2, ierr)
! END IF
! ELSE
! CALL MPI_DIMS_CREATE(num_procs, ndims, dims, ierr)
! END IF
! !
! !periodicity in p
! periods(1)=.FALSE.
! !periodicity in kr
! periods(2)=.FALSE.
! CALL MPI_CART_CREATE(MPI_COMM_WORLD, ndims, dims, periods, reorder, comm0, ierr)
nargs
=
COMMAND_ARGUMENT_COUNT
()
IF
(
nargs
.NE.
0
.AND.
nargs
.NE.
ndims
)
THEN
IF
(
my_id
.EQ.
0
)
WRITE
(
*
,
'(a,i4,a)'
)
'Number of arguments not equal to NDIMS ='
,
ndims
,
'!'
CALL
MPI_ABORT
(
MPI_COMM_WORLD
,
-1
,
ierr
)
END
IF
!
IF
(
nargs
.NE.
0
)
THEN
DO
i
=
1
,
nargs
CALL
GET_COMMAND_ARGUMENT
(
i
,
str
,
l
,
ierr
)
READ
(
str
(
1
:
l
),
'(i3)'
)
dims
(
i
)
END
DO
IF
(
PRODUCT
(
dims
)
.NE.
num_procs
)
THEN
IF
(
my_id
.EQ.
0
)
WRITE
(
*
,
'(a,i4,a,i4)'
)
'Product of dims: '
,
PRODUCT
(
dims
),
" is not consistent WITH NPROCS="
,
num_procs
CALL
MPI_ABORT
(
MPI_COMM_WORLD
,
-2
,
ierr
)
END
IF
ELSE
! CALL MPI_DIMS_CREATE(num_procs, ndims, dims, ierr)
dims
(
1
)
=
1
dims
(
2
)
=
num_procs
END
IF
! CALL MPI_COMM_RANK(comm0, me_0, ierr)
num_procs_p
=
dims
(
1
)
! Number of processes along p
num_procs_kr
=
dims
(
2
)
! Number of processes along kr
! CALL MPI_CART_COORDS(comm0,me_0,ndims,coords,ierr)
!
!periodicity in p
periods
(
1
)
=
.FALSE.
!periodicity in kr
periods
(
2
)
=
.FALSE.
! DO i=0,num_procs-1
CALL
MPI_CART_CREATE
(
MPI_COMM_WORLD
,
ndims
,
dims
,
periods
,
reorder
,
comm0
,
ierr
)
! CALL mpi_barrier(MPI_COMM_WORLD, ierr)
! IF (my_id .EQ. i) THEN
! WRITE(*,*) 'The coords of process ',me_0,' are: ', coords
! IF( coords(1) .GT. 0 ) THEN
CALL
MPI_COMM_RANK
(
comm0
,
rank_0
,
ierr
)
! CALL MPI_CART_SHIFT(comm0, 0, -1, source , nghb_L , ierr)
! CALL MPI_CART_COORDS(comm0,nghb_L,ndims,coords_L,ierr)
! WRITE(*,*) coords_L,' are L from ', coords
! ELSE
! nghb_L = MPI_PROC_NULL
! ENDIF
CALL
MPI_CART_COORDS
(
comm0
,
rank_0
,
ndims
,
coords
,
ierr
)
! IF( coords(1) .LT. dims(1)-1 ) THEN
!
! CALL MPI_CART_SHIFT(comm0, 0, +1, source , nghb_R , ierr)
! Partitions 2-dim cartesian topology of comm0 into 1-dim cartesian subgrids
! CALL MPI_CART_COORDS(comm0,nghb_R,ndims,coords_R,ierr)
!
! WRITE(*,*) coords_R,' are R from ', coords
CALL
MPI_CART_SUB
(
comm0
,
(/
.TRUE.
,
.FALSE.
/),
commp
,
ierr
)
! ELSE
CALL
MPI_CART_SUB
(
comm0
,
(/
.FALSE.
,
.TRUE.
/),
commr
,
ierr
)
! nghb_R = MPI_PROC_NULL
! Find id inside the sub communicators
! ENDIF
CALL
MPI_COMM_RANK
(
commp
,
rank_p
,
ierr
)
! ENDIF
CALL
MPI_COMM_RANK
(
commr
,
rank_r
,
ierr
)
! ENDDO
! Find neighbours
CALL
MPI_CART_SHIFT
(
comm0
,
0
,
1
,
nbr_L
,
nbr_R
,
ierr
)
! !
CALL
MPI_CART_SHIFT
(
comm0
,
1
,
1
,
nbr_B
,
nbr_T
,
ierr
)
! ! Partitions 2-dim cartesian topology of comm0 into 1-dim cartesian subgrids
! !
! CALL MPI_CART_SUB (comm0, (/.TRUE.,.FALSE./), commp, ierr)
! CALL MPI_CART_SUB (comm0, (/.FALSE.,.TRUE./), commr, ierr)
! CALL MPI_COMM_RANK(commp, me_p, ierr)
! CALL MPI_COMM_RANK(commr, me_r, ierr)
END
SUBROUTINE
ppinit
END
SUBROUTINE
ppinit
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment