forked from pelagos-consulting/Hipfort_Course
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env
110 lines (80 loc) · 2.86 KB
/
env
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#/bin/bash
if [[ $HOSTNAME =~ "setonix" ]]
then
#module swap PrgEnv-gnu/8.4.0 PrgEnv-cray
module load PrgEnv-gnu/8.4.0
module load cmake/3.27.7
module load hipfort/5.7.1
module load craype-accel-amd-gfx90a
#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${ROCM_PATH}/lib:${ROCM_PATH}/llvm/lib
#export LIBRARY_PATH=$LIBRARY_PATH:${ROCM_PATH}/lib:${ROCM_PATH}/llvm/lib
# Extra flags to enable GPU support
MPICH_GPU_SUPPORT_ENABLED=1
export HIP_PLATFORM=amd
export GPU_ARCH=gfx90a
export HIPFORT_COMPILER=ftn
export FC=$(which ftn)
export CC=$(which cc)
export CXX=$(which CC)
elif [[ $HOSTNAME =~ "noether" ]]
then
module load gcc/13.2.0 hip/5.7.3 cmake/3.27.9 hipfort/5.7.1
export HIP_PLATFORM=amd
export GPU_ARCH=gfx90a
export HIPFORT_COMPILER=$(which gfortran)
elif [[ $HOSTNAME =~ "fullcircle" ]]
then
module load gcc rocm cuda hipfort
export HIP_PLATFORM=nvidia
export GPU_ARCH="75;86"
#export HIP_PLATFORM=amd
#export GPU_ARCH="gfx1035"
export HIPFORT_COMPILER=$(which gfortran)
export FC=$(which hipfc)
export CC=$(which gcc)
export CXX=$(which g++)
elif [[ $HOSTNAME =~ "workshop" ]]
then
module load gcc rocm hipfort
export HIP_PLATFORM=amd
export GPU_ARCH="gfx906"
export HIPFORT_COMPILER=$(which gfortran)
export FC=$(which gfortran)
export CC=$(which gcc)
export CXX=$(which g++)
else
# Locations for ROCM and CUDA
#export ROCM_PATH=/opt/rocm
#export CUDA_PATH=/usr/local/cuda
# Must set HIPFORT_ROOT environment variable
#export HIPFORT_ROOT=$ROCM_PATH
# Try to make sure nvcc and hipconfig are in the path
#export PATH=${PATH}:${ROCM_PATH}/bin:${CUDA_PATH}/bin
#export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${ROCM_PATH}/lib:${CUDA_PATH}/lib64:${ROCM_PATH}/llvm/lib
#export LIBRARY_PATH=${LIBRARY_PATH}:${ROCM_PATH}/lib:${CUDA_PATH}/lib64:${ROCM_PATH}/llvm/lib
#export CPATH=${CPATH}:${ROCM_PATH}/include:${CUDA_PATH}/include:${ROCM_PATH}/llvm/include
# Try to load the necessary modules
module load rocm cuda hipfort
# Use a CUDA backend
export HIP_PLATFORM=nvidia
export GPU_ARCH="60;61;70;75;80;86;89;90"
export HIPFORT_COMPILER=$(which gfortran)
export FC=$(which gfortran)
export CC=$(which gcc)
export CXX=$(which g++)
# Use an AMD backend
#export HIP_PLATFORM=amd
#export GPU_ARCH="gfx906;gfx908;gfx90a;gfx1035"
fi
# Get the directory that this file is located in
COURSE_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# Set the installation directory
INSTALL_DIR=$COURSE_DIR/install
# Set the runtime directory
RUN_DIR=$INSTALL_DIR/bin
# Change the path
export PATH=$PATH:$RUN_DIR
# Set the build type, options are DEBUG, COVERAGE, PROFILE, RELEASE
export BUILD_TYPE=DEBUG
# Set any extra flags to hipcc here
export HIPFLAGS="-fPIC"