-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
88 lines (75 loc) · 3.38 KB
/
Makefile
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
#=======================================================================
# compiler names and flags
#=======================================================================
FC = ifort
# FC = gfortran
CPP = icx
USE_CUDA = 1
USE_CVODE = 0
USE_MATLAB = 1
COMPILE_MICROMAG = 1
CVODE_ROOT= /usr/local/sundials-4.1.0/instdir
# MATLAB_INCLUDE = /usr/local/MATLAB/R2021b/extern/include # Linux
MATLAB_INCLUDE = "C:\Program Files\MATLAB\R2023b\extern\include" # Win
# MKL_ROOT = /opt/intel/oneapi/mkl/latest # Linux - oneapi
# MKL_ROOT = ${CONDA_PREFIX} # Linux - conda
MKL_ROOT = "C:\Program Files (x86)\Intel\oneAPI\mkl\latest" # Win - oneapi
# MKL_ROOT = ${CONDA_PREFIX}/Library # Win - conda
ifeq (${FC}, ifort)
ifeq ($(OS),Windows_NT)
FFLAGS = /nologo /real-size:64 /O3 /assume:nocc_omp /Qopenmp /fpp \
/fpe:0 /fp:source /fp:precise /libs:static /DUSE_CVODE=${USE_CVODE} \
/DUSE_CUDA=${USE_CUDA} /DUSE_MATLAB=${USE_MATLAB}
else
FFLAGS = -r8 -O3 -assume nocc_omp -qopenmp -fpp -fpe0 -fp-model source \
-fp-model precise -fpic -libs:static -DUSE_CVODE=${USE_CVODE} \
-DUSE_CUDA=${USE_CUDA} -DUSE_MATLAB=${USE_MATLAB}
endif
else ifeq (${FC}, gfortran)
FFLAGS = -fPIC -O3 -fopenmp -fdefault-real-8 -ffree-line-length-512 -cpp -DUSE_CVODE=${USE_CVODE}
USE_CUDA = 0
COMPILE_MICROMAG= 0
endif
ifeq ($(USE_CUDA),0)
COMPILE_CUDA =
else
COMPILE_CUDA = cuda
endif
ifeq ($(USE_MATLAB),0)
FORCEINTEGRATOR =
else
FORCEINTEGRATOR = forceintegrator
endif
ifeq ($(COMPILE_MICROMAG),0)
MICROMAG =
else
MICROMAG = micromagnetism
endif
#=======================================================================
# Targets
#=======================================================================
.PHONY: all clean
all: magnetostatic ${MICROMAG} ${COMPILE_CUDA} ${FORCEINTEGRATOR} # standalone
magnetostatic:
cd source/NumericalIntegration/NumericalIntegration && $(MAKE) FC=$(FC) FFLAGS="$(FFLAGS)" USE_CVODE=$(USE_CVODE) CVODE_ROOT=$(CVODE_ROOT) USE_MATLAB=$(USE_MATLAB) MATLAB_INCLUDE=$(MATLAB_INCLUDE)
cd source/TileDemagTensor/TileDemagTensor && $(MAKE) FC=$(FC) FFLAGS="$(FFLAGS)" USE_CVODE=$(USE_CVODE) CVODE_ROOT=$(CVODE_ROOT) USE_MATLAB=$(USE_MATLAB) MATLAB_INCLUDE=$(MATLAB_INCLUDE)
cd source/DemagField/DemagField && $(MAKE) FC=$(FC) FFLAGS="$(FFLAGS)" USE_CVODE=$(USE_CVODE) CVODE_ROOT=$(CVODE_ROOT) USE_MATLAB=$(USE_MATLAB) MATLAB_INCLUDE=$(MATLAB_INCLUDE)
micromagnetism:
cd source/MagTenseMicroMag && $(MAKE) FFLAGS="$(FFLAGS)" USE_CVODE=$(USE_CVODE) CVODE_ROOT=$(CVODE_ROOT) USE_MATLAB=$(USE_MATLAB) MATLAB_INCLUDE=$(MATLAB_INCLUDE) MKL_ROOT=$(MKL_ROOT)
cuda:
cd source/MagTenseFortranCuda/cuda && $(MAKE) CPP=$(CPP)
forceintegrator:
cd source/MagneticForceIntegrator/MagneticForceIntegrator && $(MAKE) FC=$(FC) FFLAGS="$(FFLAGS)" MATLAB_INCLUDE=$(MATLAB_INCLUDE)
standalone:
cd source/MagTense_StandAlone/MagTense_StandAlone && $(MAKE) FC=$(FC) FFLAGS="$(FFLAGS)"
mkdir build
cp source/MagTense_StandAlone/MagTense_StandAlone/MagTense.x build/MagTense.x
clean:
cd source/NumericalIntegration/NumericalIntegration && make clean
cd source/TileDemagTensor/TileDemagTensor && make clean
cd source/DemagField/DemagField && make clean
cd source/MagTenseMicroMag && make clean
cd source/MagTenseFortranCuda/cuda && make clean
cd source/MagTense_StandAlone/MagTense_StandAlone && make clean
cd source/MagneticForceIntegrator/MagneticForceIntegrator && make clean
rm -r build/