Skip to content

Commit f31cfc9

Browse files
authored
remove INTEL20_WORKAROUND and port to mustang (#462)
1 parent 2b1727d commit f31cfc9

File tree

10 files changed

+276
-137
lines changed

10 files changed

+276
-137
lines changed

cicecore/cicedynB/dynamics/ice_transport_remap.F90

Lines changed: 2 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ module ice_transport_remap
3131

3232
use ice_kinds_mod
3333
use ice_blocks, only: nx_block, ny_block
34-
use ice_communicate, only: my_task, ice_barrier
34+
use ice_communicate, only: my_task
3535
use ice_constants, only: c0, c1, c2, c12, p333, p4, p5, p6, &
3636
eps13, eps16, &
3737
field_loc_center, field_type_scalar, &
3838
field_loc_NEcorner, field_type_vector
3939
use ice_domain_size, only: max_blocks, ncat
40-
use ice_fileunits, only: nu_diag, flush_fileunit
40+
use ice_fileunits, only: nu_diag
4141
use ice_exit, only: abort_ice
4242
use icepack_intfc, only: icepack_warnings_flush, icepack_warnings_aborted
4343
use icepack_intfc, only: icepack_query_parameters
@@ -381,127 +381,57 @@ subroutine horizontal_remap (dt, ntrace, &
381381
ilo,ihi,jlo,jhi,&! beginning and end of physical domain
382382
n, m ! ice category, tracer indices
383383

384-
! tcraig, the intel 20.0.1 compiler generates a segfault when entering this subroutine
385-
! at runtime.
386-
! This is probably a compiler bug and a workaround is to allocate the temporary data
387-
! rather than define it statically. Initial results don't show any slowdown, but
388-
! to keep the issue highlighted, an ifdef was created as a workaround.
389-
390-
#ifdef INTEL20_WORKAROUND
391-
integer (kind=int_kind), dimension(:,:), allocatable :: &
392-
#else
393384
integer (kind=int_kind), dimension(0:ncat,max_blocks) :: &
394-
#endif
395385
icellsnc ! number of cells with ice
396386

397-
#ifdef INTEL20_WORKAROUND
398-
integer (kind=int_kind), dimension(:,:), allocatable :: &
399-
#else
400387
integer (kind=int_kind), dimension(nx_block*ny_block,0:ncat) :: &
401-
#endif
402388
indxinc, indxjnc ! compressed i/j indices
403389

404-
#ifdef INTEL20_WORKAROUND
405-
real (kind=dbl_kind), dimension(:,:), allocatable :: &
406-
#else
407390
real (kind=dbl_kind), dimension(nx_block,ny_block) :: &
408-
#endif
409391
edgearea_e ,&! area of departure regions for east edges
410392
edgearea_n ! area of departure regions for north edges
411393

412-
#ifdef INTEL20_WORKAROUND
413-
real (kind=dbl_kind), dimension (:,:,:), allocatable :: &
414-
#else
415394
real (kind=dbl_kind), dimension (nx_block,ny_block,max_blocks) :: &
416-
#endif
417395
dpx ,&! x coordinates of departure points at cell corners
418396
dpy ! y coordinates of departure points at cell corners
419397

420-
#ifdef INTEL20_WORKAROUND
421-
real (kind=dbl_kind), dimension(:,:,:,:), allocatable :: &
422-
#else
423398
real (kind=dbl_kind), dimension(nx_block,ny_block,0:ncat,max_blocks) :: &
424-
#endif
425399
mc ,&! mass at geometric center of cell
426400
mx, my ! limited derivative of mass wrt x and y
427401

428-
#ifdef INTEL20_WORKAROUND
429-
real (kind=dbl_kind), dimension(:,:,:), allocatable :: &
430-
#else
431402
real (kind=dbl_kind), dimension(nx_block,ny_block,0:ncat) :: &
432-
#endif
433403
mmask ! = 1. if mass is present, = 0. otherwise
434404

435-
#ifdef INTEL20_WORKAROUND
436-
real (kind=dbl_kind), dimension (:,:,:,:,:), allocatable :: &
437-
#else
438405
real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat,max_blocks) :: &
439-
#endif
440406
tc ,&! tracer values at geometric center of cell
441407
tx, ty ! limited derivative of tracer wrt x and y
442408

443-
#ifdef INTEL20_WORKAROUND
444-
real (kind=dbl_kind), dimension (:,:,:,:), allocatable :: &
445-
#else
446409
real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat) :: &
447-
#endif
448410
tmask ! = 1. if tracer is present, = 0. otherwise
449411

450-
#ifdef INTEL20_WORKAROUND
451-
real (kind=dbl_kind), dimension (:,:,:), allocatable :: &
452-
#else
453412
real (kind=dbl_kind), dimension (nx_block,ny_block,0:ncat) :: &
454-
#endif
455413
mflxe, mflxn ! mass transports across E and N cell edges
456414

457-
#ifdef INTEL20_WORKAROUND
458-
real (kind=dbl_kind), dimension (:,:,:,:), allocatable :: &
459-
#else
460415
real (kind=dbl_kind), dimension (nx_block,ny_block,ntrace,ncat) :: &
461-
#endif
462416
mtflxe, mtflxn ! mass*tracer transports across E and N cell edges
463417

464-
#ifdef INTEL20_WORKAROUND
465-
real (kind=dbl_kind), dimension (:,:,:), allocatable :: &
466-
#else
467418
real (kind=dbl_kind), dimension (nx_block,ny_block,ngroups) :: &
468-
#endif
469419
triarea ! area of east-edge departure triangle
470420

471-
#ifdef INTEL20_WORKAROUND
472-
real (kind=dbl_kind), dimension (:,:,:,:), allocatable :: &
473-
#else
474421
real (kind=dbl_kind), dimension (nx_block,ny_block,0:nvert,ngroups) :: &
475-
#endif
476422
xp, yp ! x and y coordinates of special triangle points
477423
! (need 4 points for triangle integrals)
478-
#ifdef INTEL20_WORKAROUND
479-
integer (kind=int_kind), dimension (:,:,:), allocatable :: &
480-
#else
481424
integer (kind=int_kind), dimension (nx_block,ny_block,ngroups) :: &
482-
#endif
483425
iflux ,&! i index of cell contributing transport
484426
jflux ! j index of cell contributing transport
485427

486-
#ifdef INTEL20_WORKAROUND
487-
integer (kind=int_kind), dimension(:,:), allocatable :: &
488-
#else
489428
integer (kind=int_kind), dimension(ngroups,max_blocks) :: &
490-
#endif
491429
icellsng ! number of cells with ice
492430

493-
#ifdef INTEL20_WORKAROUND
494-
integer (kind=int_kind), dimension(:,:), allocatable :: &
495-
#else
496431
integer (kind=int_kind), dimension(nx_block*ny_block,ngroups) :: &
497-
#endif
498432
indxing, indxjng ! compressed i/j indices
499433

500-
#ifdef INTEL20_WORKAROUND
501-
integer (kind=int_kind), dimension(:,:,:), allocatable :: &
502-
#else
503434
integer (kind=int_kind), dimension(nx_block,ny_block,max_blocks) :: &
504-
#endif
505435
halomask ! temporary mask for fast halo updates
506436

507437
logical (kind=log_kind) :: &
@@ -525,37 +455,6 @@ subroutine horizontal_remap (dt, ntrace, &
525455
!---! Remap the open water area (without tracers).
526456
!---!-------------------------------------------------------------------
527457

528-
#ifdef INTEL20_WORKAROUND
529-
allocate(icellsnc(0:ncat,max_blocks))
530-
allocate(indxinc(nx_block*ny_block,0:ncat))
531-
allocate(indxjnc(nx_block*ny_block,0:ncat))
532-
allocate(edgearea_e(nx_block,ny_block))
533-
allocate(edgearea_n(nx_block,ny_block))
534-
allocate(dpx(nx_block,ny_block,max_blocks))
535-
allocate(dpy(nx_block,ny_block,max_blocks))
536-
allocate(mc(nx_block,ny_block,0:ncat,max_blocks))
537-
allocate(mx(nx_block,ny_block,0:ncat,max_blocks))
538-
allocate(my(nx_block,ny_block,0:ncat,max_blocks))
539-
allocate(mmask(nx_block,ny_block,0:ncat))
540-
allocate(tc(nx_block,ny_block,ntrace,ncat,max_blocks))
541-
allocate(tx(nx_block,ny_block,ntrace,ncat,max_blocks))
542-
allocate(ty(nx_block,ny_block,ntrace,ncat,max_blocks))
543-
allocate(tmask(nx_block,ny_block,ntrace,ncat))
544-
allocate(mflxe(nx_block,ny_block,0:ncat))
545-
allocate(mflxn(nx_block,ny_block,0:ncat))
546-
allocate(mtflxe(nx_block,ny_block,ntrace,ncat))
547-
allocate(mtflxn(nx_block,ny_block,ntrace,ncat))
548-
allocate(triarea(nx_block,ny_block,ngroups))
549-
allocate(xp(nx_block,ny_block,0:nvert,ngroups))
550-
allocate(yp(nx_block,ny_block,0:nvert,ngroups))
551-
allocate(iflux(nx_block,ny_block,ngroups))
552-
allocate(jflux(nx_block,ny_block,ngroups))
553-
allocate(icellsng(ngroups,max_blocks))
554-
allocate(indxing(nx_block*ny_block,ngroups))
555-
allocate(indxjng(nx_block*ny_block,ngroups))
556-
allocate(halomask(nx_block,ny_block,max_blocks))
557-
#endif
558-
559458
!--- tcraig, tcx, this omp loop leads to a seg fault in gnu
560459
!--- need to check private variables and debug further
561460
!$TCXOMP PARALLEL DO PRIVATE(iblk,ilo,ihi,jlo,jhi,this_block,n,m, &
@@ -948,37 +847,6 @@ subroutine horizontal_remap (dt, ntrace, &
948847
enddo ! iblk
949848
!$TCXOMP END PARALLEL DO
950849

951-
#ifdef INTEL20_WORKAROUND
952-
deallocate(icellsnc)
953-
deallocate(indxinc)
954-
deallocate(indxjnc)
955-
deallocate(edgearea_e)
956-
deallocate(edgearea_n)
957-
deallocate(dpx)
958-
deallocate(dpy)
959-
deallocate(mc)
960-
deallocate(mx)
961-
deallocate(my)
962-
deallocate(mmask)
963-
deallocate(tc)
964-
deallocate(tx)
965-
deallocate(ty)
966-
deallocate(tmask)
967-
deallocate(mflxe)
968-
deallocate(mflxn)
969-
deallocate(mtflxe)
970-
deallocate(mtflxn)
971-
deallocate(triarea)
972-
deallocate(xp)
973-
deallocate(yp)
974-
deallocate(iflux)
975-
deallocate(jflux)
976-
deallocate(icellsng)
977-
deallocate(indxing)
978-
deallocate(indxjng)
979-
deallocate(halomask)
980-
#endif
981-
982850
end subroutine horizontal_remap
983851

984852
!=======================================================================

configuration/scripts/cice.batch.csh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,15 @@ cat >> ${jobfile} << EOFB
9191
#PBS -l walltime=${batchtime}
9292
EOFB
9393

94-
else if (${ICE_MACHINE} =~ thunder* || ${ICE_MACHINE} =~ gordon* || ${ICE_MACHINE} =~ conrad* || ${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr*) then
94+
else if (${ICE_MACHINE} =~ thunder* || ${ICE_MACHINE} =~ gordon* || ${ICE_MACHINE} =~ conrad* || ${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr* || ${ICE_MACHINE} =~ mustang) then
9595
cat >> ${jobfile} << EOFB
9696
#PBS -N ${shortcase}
9797
#PBS -q ${queue}
9898
#PBS -A ${acct}
9999
#PBS -l select=${nnodes}:ncpus=${maxtpn}:mpiprocs=${taskpernode}
100100
#PBS -l walltime=${batchtime}
101101
#PBS -j oe
102+
#PBS -W umask=022
102103
###PBS -M username@domain.com
103104
###PBS -m be
104105
EOFB

configuration/scripts/cice.launch.csh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ EOFR
5858
endif
5959

6060
#=======
61-
else if (${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr*) then
61+
else if (${ICE_MACHINE} =~ gaffney* || ${ICE_MACHINE} =~ koehr* || ${ICE_MACHINE} =~ mustang*) then
6262
if (${ICE_COMMDIR} =~ serial*) then
6363
cat >> ${jobfile} << EOFR
6464
./cice >&! \$ICE_RUNLOG_FILE
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#==============================================================================
2+
# Macros file for AFRL mustang, intel compiler
3+
#==============================================================================
4+
5+
CPP := fpp
6+
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
7+
CFLAGS := -c -O2 -fp-model precise -xHost
8+
9+
FIXEDFLAGS := -132
10+
FREEFLAGS := -FR
11+
FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost
12+
FFLAGS_NOOPT:= -O0
13+
14+
ifeq ($(ICE_BLDDEBUG), true)
15+
FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created
16+
else
17+
FFLAGS += -O2
18+
endif
19+
20+
SCC := icc
21+
SFC := ifort
22+
MPICC := icc
23+
MPIFC := ifort
24+
25+
ifeq ($(ICE_COMMDIR), mpi)
26+
FC := $(MPIFC)
27+
CC := $(MPICC)
28+
else
29+
FC := $(SFC)
30+
CC := $(SCC)
31+
endif
32+
LD:= $(FC)
33+
34+
#defined by env
35+
#NETCDF_PATH := $(NETCDF_PATH)
36+
37+
INCLDIR += -I$(NETCDF_PATH)/include
38+
LIB_NETCDF := $(NETCDF_PATH)/lib
39+
SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lmpi
40+
41+
ifeq ($(ICE_THREADED), true)
42+
LDFLAGS += -qopenmp
43+
CFLAGS += -qopenmp
44+
FFLAGS += -qopenmp
45+
endif
46+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#==============================================================================
2+
# Macros file for AFRL mustang, intel compiler
3+
#==============================================================================
4+
5+
CPP := fpp
6+
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
7+
CFLAGS := -c -O2 -fp-model precise -xHost
8+
9+
FIXEDFLAGS := -132
10+
FREEFLAGS := -FR
11+
FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost
12+
FFLAGS_NOOPT:= -O0
13+
14+
ifeq ($(ICE_BLDDEBUG), true)
15+
FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created
16+
else
17+
FFLAGS += -O2
18+
endif
19+
20+
SCC := icc
21+
SFC := ifort
22+
MPICC := icc
23+
MPIFC := ifort
24+
25+
ifeq ($(ICE_COMMDIR), mpi)
26+
FC := $(MPIFC)
27+
CC := $(MPICC)
28+
else
29+
FC := $(SFC)
30+
CC := $(SCC)
31+
endif
32+
LD:= $(FC)
33+
34+
#defined by env
35+
#NETCDF_PATH := $(NETCDF_PATH)
36+
37+
INCLDIR += -I$(NETCDF_PATH)/include
38+
LIB_NETCDF := $(NETCDF_PATH)/lib
39+
SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lmpi
40+
41+
ifeq ($(ICE_THREADED), true)
42+
LDFLAGS += -qopenmp
43+
CFLAGS += -qopenmp
44+
FFLAGS += -qopenmp
45+
endif
46+
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
#==============================================================================
2+
# Macros file for AFRL mustang, intel compiler
3+
#==============================================================================
4+
5+
CPP := fpp
6+
CPPDEFS := -DFORTRANUNDERSCORE ${ICE_CPPDEFS}
7+
CFLAGS := -c -O2 -fp-model precise -xHost
8+
9+
FIXEDFLAGS := -132
10+
FREEFLAGS := -FR
11+
FFLAGS := -fp-model precise -convert big_endian -assume byterecl -ftz -traceback -xHost
12+
FFLAGS_NOOPT:= -O0
13+
14+
ifeq ($(ICE_BLDDEBUG), true)
15+
FFLAGS += -O0 -g -check uninit -check bounds -check pointers -fpe0 -check noarg_temp_created
16+
else
17+
FFLAGS += -O2
18+
endif
19+
20+
SCC := icc
21+
SFC := ifort
22+
MPICC := icc
23+
MPIFC := ifort
24+
25+
ifeq ($(ICE_COMMDIR), mpi)
26+
FC := $(MPIFC)
27+
CC := $(MPICC)
28+
else
29+
FC := $(SFC)
30+
CC := $(SCC)
31+
endif
32+
LD:= $(FC)
33+
34+
#defined by env
35+
#NETCDF_PATH := $(NETCDF_PATH)
36+
37+
INCLDIR += -I$(NETCDF_PATH)/include
38+
LIB_NETCDF := $(NETCDF_PATH)/lib
39+
SLIBS := -L$(LIB_NETCDF) -lnetcdf -lnetcdff -lmpi
40+
41+
ifeq ($(ICE_THREADED), true)
42+
LDFLAGS += -qopenmp
43+
CFLAGS += -qopenmp
44+
FFLAGS += -qopenmp
45+
endif
46+

configuration/scripts/machines/env.izumi_intel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ endif
1919
setenv ICE_MACHINE_ENVNAME izumi
2020
setenv ICE_MACHINE_COMPILER intel
2121
setenv ICE_MACHINE_MAKE gmake
22-
setenv ICE_MACHINE_CPPDEFS '"-DINTEL20_WORKAROUND"'
22+
setenv ICE_MACHINE_CPPDEFS ""
2323
setenv ICE_MACHINE_WKDIR /scratch/cluster/$user/CICE_RUNS
2424
setenv ICE_MACHINE_INPUTDATA /fs/cgd/csm/inputdata
2525
setenv ICE_MACHINE_BASELINE /scratch/cluster/$user/CICE_BASELINE

0 commit comments

Comments
 (0)