forked from rahulbgu/PICTOR
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
executable file
·123 lines (103 loc) · 4.03 KB
/
Copy pathMakefile
File metadata and controls
executable file
·123 lines (103 loc) · 4.03 KB
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
111
112
113
114
115
116
117
118
119
120
121
122
123
#MakeFile for the PIC simulation
SHELL=/bin/sh
#---------------------------------------------------------------------------------------
# Change the followings to set up the PIC simulation
#---------------------------------------------------------------------------------------
SETUP=setup_alfventurb
SETUP=setup_weibel
SETUP=setup_shock
#SETUP=setup_shear_flow
#SETUP=setup_Bell
#SETUP=setup_friction
#SETUP=setup_harris_sheet
#THREE_DIMS=y# y = three spatial dimensions
#OPEN_MP=y #to include openmp support NOTE: include -qopenmp (for intel) or -fopenmp (for gcc) in
#GPU=y #option A: (GPU+CPU) GPUs reduce workload from CPU by diving a subdomain
#GPU_EXCLUSIVE=y #option B (preffered) : subdomains lie entirely on GPUs
#GPU_USE_INTRINSICS=y #for a more optimized gpu version
#----------------------------------------------------------------------------------------
# settings for the compiler
#----------------------------------------------------------------------------------------
cc= gcc#use "icc" for intel compilers
FC= h5pfc
FLAGS= -O3 -cpp -fno-range-check -ffree-line-length-none #use to run the simulation using GCC compiler
#FLAGS= -O3 -cpp -ipo -xHost#for intel compiler
#FLAGS= -O3 -g -fbacktrace -fcheck=all -cpp -fno-range-check -ffree-line-length-none -fbounds-check -fimplicit-none#-fimplicit-none # use for debugging
#FLAGS= -O3 -Mcuda=7.5 # for GPU runs (using PGI fortran)
#@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ END OF MAKEFILE SETTINGS @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
#---------------------------------------------------------------------
# DO NOT CHANGE THE FOLLOWING UNLESS THE MAIN CODE IS MODIFIED
#-----------------------------------------------------------------------------------------
ifeq ($(THREE_DIMS),y)
else
CUSTOM :=$(CUSTOM) -DtwoD
endif
TYPE=PIC
CUSTOM :=$(CUSTOM) -Dmulflvr#to have muplitle species of different q/m
ifeq ($(TYPE),PIC)
MOVDEP=movdepVEC.o#for standard PIC simualtion
CUSTOM :=$(CUSTOM) -DPIC
else ifeq ($(TYPE),GyroKinetic)
MOVDEP=movdepGyroKinetic.o#for gyrokinetic PIC simulation
CUSTOM :=$(CUSTOM) -DGyroKinetic
else ifeq ($(TYPE),Hybrid1)
MOVDEP=movdepPIC.o
CUSTOM :=$(CUSTOM) -DHybrid1
else ifeq ($(TYPE),Hybrid2)
MOVDEP=movdepPIC.o
CUSTOM :=$(CUSTOM) -DHybrid2
else ifeq ($(TYPE),Hybrid3)
MOVDEP=movdepPIC.o
CUSTOM :=$(CUSTOM) -DHybrid3
endif
CPU=y
GPU_INCLUDE=n
ifeq ($(GPU_EXCLUSIVE),y)
CPU=n
endif
#Add GPU flag for preprocessing
ifeq ($(CPU),y)
CUSTOM :=$(CUSTOM) -DCPU
endif
#Add GPU flag for preprocessing
ifeq ($(GPU),y)
CUSTOM :=$(CUSTOM) -Dgpu
GPU_INCLUDE=y
endif
#add openmp flag for preprocessing code
ifeq ($(OPEN_MP),y)
CUSTOM :=$(CUSTOM) -DOPEN_MP
endif
#Add Exclusive GPU flag
ifeq ($(GPU_EXCLUSIVE),y)
CUSTOM :=$(CUSTOM) -DGPU_EXCLUSIVE
GPU_INCLUDE=y
endif
#Use some more optimised GPU subroutines
ifeq ($(GPU_USE_INTRINSICS),y)
CUSTOM :=$(CUSTOM) -DGPU_USE_INTRINSICS
endif
FFLAGS= $(CUSTOM) $(FLAGS)
EXECUTABLE= PICTOR
VPATH=src
OBJDIR=build
ifeq ($(GPU_INCLUDE),y)
OBJS= $(addprefix $(OBJDIR)/, parameters.o vars.o var_gpu.o communication.o memory.o interpolation.o prtl_stats.o deposit.o $(MOVDEP) comm_fldprtl.o loadprtlout_gpu.o particles.o fields.o \
HDF5write.o savedata_routines.o comm_savedata.o comm_fld_gpu.o savedata_gpu.o savedata.o help_setup.o DerivedQnty.o comm_loadbalance.o loadbalance.o $(SETUP).o reload.o initialise.o \
comm_prtl_gpu.o inc_scan.o thrust_module.o memory_gpu.o fields_gpu.o movdep_gpu.o initialise_gpu.o MAIN.o)
else
OBJS= $(addprefix $(OBJDIR)/, parameters.o vars.o communication.o memory.o interpolation.o prtl_stats.o deposit.o $(MOVDEP) comm_fldprtl.o loadprtlout.o particles.o fields.o HDF5write.o\
savedata_routines.o comm_savedata.o savedata.o help_setup.o DerivedQnty.o comm_loadbalance.o loadbalance.o $(SETUP).o reload.o initialise.o MAIN.o)
endif
all: $(EXECUTABLE)
$(OBJDIR)/%.o:%.F90
$(FC) $(FFLAGS) $(INCPATH) -c $^ -o $@
$(OBJDIR)/%.o:%.cu -o $@
nvcc -c $^
$(EXECUTABLE): $(OBJS)
$(FC) $(FFLAGS) -o $@ $(OBJS)
mv *.mod $(OBJDIR)/
clean:
rm -f $(OBJDIR)/*.o
rm -f $(OBJDIR)/*.mod
rm -f $(EXECUTABLE)