Skip to content

Commit

Permalink
add Cray compiler to build system
Browse files Browse the repository at this point in the history
- ignore temp files generated by Cray Fortran
- workaround Cray not having reduce
  • Loading branch information
jeffhammond committed Aug 17, 2022
1 parent 3a0fec6 commit 8bda56d
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ src/fortran/BabelStream.*
*.gz
*.a
*.mod
*.cub
*.ptx

KokkosCore_config.*

Expand Down
4 changes: 4 additions & 0 deletions src/fortran/DoConcurrentStream.F90
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ function dot() result(s)
integer(kind=StreamIntKind) :: i
! reduction omitted because NVF infers it and other compilers do not support
s = real(0,kind=REAL64)
#ifdef CRAY_THREAD_DOCONCURRENT
do i=1,N
#else
do concurrent (i=1:N) shared(A,B)
#endif
s = s + A(i) * B(i)
end do
end function dot
Expand Down
2 changes: 2 additions & 0 deletions src/fortran/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ else ifeq ($(COMPILER),oneapi)
include make.inc.oneapi
else ifeq ($(COMPILER),gcc)
include make.inc.gcc
else ifeq ($(COMPILER),cray)
include make.inc.cray
else
$(info Set COMPILER={nvhpc,oneapi}. Default is gcc.)
include make.inc.gcc
Expand Down
1 change: 1 addition & 0 deletions src/fortran/OpenMPTargetStream.F90
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ subroutine copy()
do i=1,N
C(i) = A(i)
end do
!$omp barrier
end subroutine copy

subroutine add()
Expand Down
13 changes: 3 additions & 10 deletions src/fortran/build.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
#!/bin/bash

for compiler in oneapi ; do
for implementation in DoConcurrent Array OpenMP OpenMPWorkshare OpenMPTarget OpenMPTargetLoop OpenMPTaskloop ; do
make COMPILER=${compiler} IMPLEMENTATION=${implementation}
done
done
#exit
for compiler in nvhpc ; do
for implementation in DoConcurrent Array OpenMP OpenMPWorkshare OpenMPTarget OpenMPTargetLoop OpenMPTaskloop OpenACC OpenACCArray CUDA CUDAKernel ; do
make COMPILER=${compiler} IMPLEMENTATION=${implementation}
done
compiler=cray
for implementation in DoConcurrent Array OpenMP OpenMPWorkshare OpenMPTarget OpenMPTargetLoop OpenMPTaskloop OpenACC OpenACCArray ; do
make COMPILER=${compiler} IMPLEMENTATION=${implementation}
done
16 changes: 16 additions & 0 deletions src/fortran/make.inc.cray
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FC := ftn
FCFLAGS = -e F -O3

DOCONCURRENT_FLAG = -h thread_do_concurrent -DCRAY_THREAD_DOCONCURRENT
ARRAY_FLAG = -h autothread
OPENMP_FLAG = -h omp
OPENACC_FLAG = -h acc
CUDA_FLAG =
SEQUENTIAL_FLAG =

ifeq ($(IMPLEMENTATION),CUDA)
$(error IMPLEMENTATION=$(IMPLEMENTATION) is not supported by this compiler.)
endif
ifeq ($(IMPLEMENTATION),CUDAKernels)
$(error IMPLEMENTATION=$(IMPLEMENTATION) is not supported by this compiler.)
endif
26 changes: 11 additions & 15 deletions src/fortran/run.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
#!/bin/bash

export KMP_HW_PLACES=1s,4c,1t
export KMP_HW_SUBSET=1s,4c,1t
export KMP_AFFINITY=compact,granularity=fine #,verbose
M=64

compiler=cray
# CPU
for compiler in oneapi ; do
for implementation in DoConcurrent Array OpenMP OpenMPWorkshare OpenMPTaskloop ; do
if [ -f BabelStream.${compiler}.${implementation} ] ; then
./BabelStream.${compiler}.${implementation} -s $((1024*1024*64))
fi
done
for implementation in DoConcurrent Array OpenMP OpenMPWorkshare OpenMPTaskloop ; do
if [ -f BabelStream.${compiler}.${implementation} ] ; then
./BabelStream.${compiler}.${implementation} -s $((1024*1024*${M}))
fi
done
exit
# GPU
for compiler in nvhpc ; do
for implementation in DoConcurrent OpenMPTarget OpenMPTargetLoop OpenACC OpenACCArray CUDA CUDAKernel ; do
if [ -f BabelStream.${compiler}.${implementation} ] ; then
./BabelStream.${compiler}.${implementation} -s $((1024*1024*64))
fi
done
for implementation in OpenMPTarget OpenMPTargetLoop OpenACC OpenACCArray ; do
if [ -f BabelStream.${compiler}.${implementation} ] ; then
./BabelStream.${compiler}.${implementation} -s $((1024*1024*${M}))
fi
done

0 comments on commit 8bda56d

Please sign in to comment.