-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathconfigure
More file actions
executable file
·804 lines (712 loc) · 23.7 KB
/
Copy pathconfigure
File metadata and controls
executable file
·804 lines (712 loc) · 23.7 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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
#!/bin/bash
printf "configure script for AmberClassic\n\n"
# Store the command
command=`echo "$0 $*"`
#------------------------------------------------------------------------------
# Set up defaults:
#------------------------------------------------------------------------------
# --- General:
AmberClassicHome=`pwd`
verbose="@"
requested_help="no"
openblas="no"
mkl="no"
mklinc=""
sfx=""
debug="-DNDEBUG"
fpic="-fPIC"
conda="no"
conda_incflags=""
installtype="serial"
xblasflag="-DCONFIG_FC_UNDERSCORE"
# --- C compiler:
compiler="gnu"
cc="gcc"
cxx="g++"
mpicc="mpicc"
gccflags="-Wno-unused-result"
clangflags=""
clangf=""
gcc10c="-fcommon"
ldflags=""
# --- Fortran compiler:
fc="gfortran"
flibs_arch="-lgfortran -w"
flibs_la=""
flibs_fftw="-lfftw3_omp -lfftw3"
flibs_mkl=""
mpif90="mpif90"
gccsys=""
optflags="-g -O3 -mtune=native"
optmkl=""
gcc10f="-fno-strict-aliasing -Wno-argument-mismatch -fallow-argument-mismatch -fno-inline-arg-packing"
longlines="-ffree-line-length-none"
inc="-I$AmberClassicHome/include"
openmp='yes'
ompflag=""
ompcflag=""
arpack="libarpack"
# --- linear algebra, netcdf, boost, fftw:
boost="yes"
# current default is to use locally-compiled boost subset:
boostlib="\$(LIBDIR)/libboost_program_options.a \$(LIBDIR)/libboost_iostreams.a -lz -lbz2"
netcdflibf_static="\$(LIBDIR)/libnetcdff.a \$(LIBDIR)/libnetcdf.a"
netcdflibf_shared="-L\$(LIBDIR) -lnetcdff -lnetcdf"
netcdflibf=$netcdflibf_static
lapack="skip"
blas="skip"
macAccelerate="no"
fftw_flags=""
gnuld="yes"
# --- cuda:
cuda="no"
cudaflags=''
cudafflags=''
cuda_arch=''
cuda_arch_flags=''
uspec_arch='false'
cuda_prec='SPFP'
# --- other:
#short_ene=short_ene_omp.o
short_ene=short_ene.o # short_ene_omp may slow things down or even crash
moft="moft"
plumed="no"
#------------------------------------------------------------------------------
# Process command-line flags:
#------------------------------------------------------------------------------
while [ $# -gt 0 ]; do
case "$1" in
-h|-H|--h|--he|--hel|--help|-help)
requested_help="yes";;
--verbose)
verbose="";;
--debug)
debug="";;
--noopenmp)
flibs_fftw="-lfftw3"
openmp="no";;
--cuda)
cuda="yes"
installtype="cuda"
cudafflags="-DCUDA"
fpic="";;
--cudaprec) shift; cuda_prec="$1";;
--cudaarch) shift; cuda_arch="$cuda_arch $1"; uspec_arch='true';;
--nogcc10)
gcc10f=""
gcc10c="";;
--conda)
conda_incflags="-I$CONDA_PREFIX/include"
clangf="-DCLANG"
clangflags="-Wno-parentheses"
installtype="conda"
cc=$CC
cxx=$CXX
fc=$FC
ldflags=$LDFLAGS
arpack="skip"
conda="yes";;
--noboost)
boost="no"
moft="skip";;
--system-boost)
boostlib="-lboost_program_options -lboost_iostreams"
boost="system";;
--openblas)
openblas="yes";;
--mkl)
mkl="yes"
optmkl="-DMKL"
flibs_fftw="";;
--macAccelerate)
macAccelerate="yes";;
--static)
ldflags="-static $ldflags";;
--plumed)
plumed="yes";;
--clang)
compiler="clang"
clangf="-DCLANG"
clangflags="-Wno-parentheses"
cc="clang"
cxx="clang++"
fc="gfortran"
gccflags=""
# following assumes this is OSX:
for x in `gfortran -print-search-dirs | grep libraries | \
sed -e "s/libraries: =//g" -e "s/:/ /g"`; do
test -f $x/libgfortran.dylib && break
done
flibs_arch="-L$x -lgfortran -w -Wl,-rpath $x"
optflags="-g -O3";;
--oneapi)
compiler="oneapi"
cc="icx-cc"
cxx="icpx"
fc="ifx"
gccflags=""
flibs_arch=""
longlines=""
gcc10f=""
gcc10c=""
optflags="-g -O3 -mtune=native";;
--mpi)
mpi="yes"
fftw_flags="--enable-mpi=yes"
mpiflag="-DMPI"
short_ene=short_ene.o
installtype="parallel"
sfx=".MPI";;
*)
echo "Option $1 not recognized"
exit 1
esac
shift
done
if [ "$requested_help" = "yes" ] ; then
printf "Usage: ./configure [OPTIONS]\n"
printf "\nCompilers:\n"
printf " --clang use clang/gfortran; gcc/gfortran is default\n"
printf " (implies OSX; no openmp support for now)\n"
printf " --oneapi Use Intel oneapi compilers\n"
printf " --verbose give build details, otherwise be more silent\n"
printf " --nogcc10 use flags for gcc9 and below\n"
printf "\nPerformance options:\n"
printf " --noopenmp don't use of OPENMP in msander and libsff\n"
printf " --mpi build only msander.MPI and mdgx.MPI; uses mpi stack in PATH\n"
printf " --cuda build only msander.cuda\n"
printf " [With both --mpi and --cuda, build only msander.cuda.MPI]\n"
printf " --cudaprec [SPFP|DPFP], cuda precision, default is SPFP\n"
printf " --cudaarch <kepler|maxwell|pascal|volta|turing|ampere|ada>\n"
printf "\nLess-common options:\n\n"
printf " --openblas use openBLAS routines from a system library\n"
printf " --mkl use MKL for LAPACK/BLAS/FFTW\n"
printf " --macAccelerate use Apple Accelerate framework for linear algebra\n"
printf " --system-boost use system boost rather than built-in subset\n"
printf " --static use static linking (experimental)\n"
printf "\n"
exit 0
fi
# extra logic related to command-line arguments: generally, things
# that need to be decided only after all arguments have been processed
if [ "$openmp" == "yes" ]; then
if [ "$compiler" == "clang" ]; then
ompcflag="-Xclang -fopenmp -DOPENMP"
elif [ "$compiler" == "oneapi" ]; then
ompcflag="-qopenmp -DOPENMP"
else
ompcflag="-fopenmp -DOPENMP"
fi
ompflag="-fopenmp -DOPENMP"
fi
if [ "$mpi" == "yes" ]; then
fc="$mpif90"
cc="$mpicc"
flibs_fftw="-lfftw3_mpi $flibs_fftw -lmpi"
fi
if [ "$mpi" == "yes" -a "$cuda" == "yes" ]; then
installtype="mpicuda"
fi
#------------------------------------------------------------------------------
# Make some needed directories:
#------------------------------------------------------------------------------
mkdir -p bin
mkdir -p bin/wrapped_progs
mkdir -p lib
mkdir -p include
cp src/msander/sander.h include
#------------------------------------------------------------------------------
# Initialize variables that are architecture specific:
#------------------------------------------------------------------------------
OS=`uname -s`
if [ "$OS" = "Darwin" ]; then
is_mac='yes'
shared_suffix=.dylib
make_shared=-dynamiclib
lm=
else
is_mac='no'
shared_suffix=.so
make_shared=-shared
lm=-lm
fi
#--------------------------------------------------------------------------
# Test if the C compiler works:
#--------------------------------------------------------------------------
cat <<EOF >testp.c
#include <stdio.h>
int main()
{
printf( "testing a C program\n" );
}
EOF
cc_version=`$cc --version 2>&1 | head -1`
printf "Testing $cc_version ..."
$cc -o testp testp.c
./testp | grep "testing a C program" > /dev/null
status=$?
if [ $status -gt 0 ]; then
printf "\nError: Unable to compile a C program using gcc\n"
printf " Please check your compiler settings.\n"
exit 1
else
printf "OK\n"
fi
/bin/rm -f testp.c testp.o testp
#--------------------------------------------------------------------------
# Test if the Fortran compiler works:
#--------------------------------------------------------------------------
cat <<EOF >testp.f
program testf
write(6,*) 'testing a Fortran program'
end program testf
EOF
fc_version=`$fc --version 2>&1 | head -1`
printf "Testing $fc_version ..."
$fc -o testp testp.f
./testp | grep "testing a Fortran program" > /dev/null
status=$?
if [ $status -gt 0 ]; then
printf "\nError: Unable to compile a Fortran program using gfortran\n"
printf " Please check your compiler settings.\n"
exit 1
else
printf "OK\n"
fi
/bin/rm -f testp.f testp.o testp
#--------------------------------------------------------------------------
# Test if bison is available and works
#--------------------------------------------------------------------------
printf "Testing bison ..."
cat <<EOF >testp.y
%{
static int curItemNo, curValueNo, itemIndex;
%}
%token NUMBER
%%
term: NUMBER { curItemNo = 1; }
%%
EOF
bison -y testp.y
status=$?
if [ $status -gt 0 ]; then
echo ""
echo "Error: Unable to run bison."
echo " Please check your PATH, or install the program."
echo ""
exit 1
else
printf "OK\n\n"
fi
/bin/rm -f testp.y y.tab.c
#--------------------------------------------------------------------------
# Configure the linear algebra libraries:
# N.B. if --mkl is set, flibs_la is set in the MKL section below
#--------------------------------------------------------------------------
if [ "$openblas" == "yes" ]; then
echo "using OpenBLAS libraries from system"
flibs_la="-larpack -lopenblas -lpthread"
elif [ "$conda" == "yes" ]; then
echo "using OpenBLAS libraries from conda-forge"
echo "using arpack libraries from conda-forge"
flibs_la="-L$CONDA_PREFIX/lib -lopenblas -larpack -lpthread"
elif [ "$macAccelerate" == "yes" ]; then
echo "using macAccelerate frameworks"
flibs_la="-larpack -framework Accelerate"
else
# use the compiled versions;
flibs_la="-larpack -llapack -lblas"
lapack=liblapack
blas=libblas
fi
#--------------------------------------------------------------------------
# Configure and build netcdf:
#--------------------------------------------------------------------------
if [ "$conda" == "yes" ]; then
netcdflibf="-L$CONDA_PREFIX/lib -lnetcdff -lnetcdf"
echo "using netcdf libraries from conda-forge"
elif [ ! -s "lib/libnetcdf.a" ]; then
cd src/netcdf-c-4.7.2
printf "Configuring the NetCDF C interface..."
make clean > /dev/null 2>&1
./configure CC="$cc" CFLAGS="-fPIC" LDFLAGS="" \
--prefix=$AmberClassicHome --disable-netcdf-4 --disable-dap \
--disable-shared --disable-doxygen > ../netcdf_c.config.log 2>&1
ncerror=$?
if [ $ncerror -gt 0 ]; then
echo "Error: NetCDF configure failed! Check netcdf_c.config.log"
exit 1
else
echo "OK"
fi
# The NetCDF C interface MUST be present prior to configuring the
# Fortran interface, so build it now.
printf "Compiling the NetCDF C interface..."
make install > ../netcdf_c.compile.log 2>&1
if [ $? -ne 0 ]; then
echo "Error: NetCDF compile failed! Check netcdf_c.compile.log"
exit 1
else
echo "OK"
fi
# NetCDF Fortran configure/build
cd ../netcdf-fortran-4.5.2
# The NetCDF Fortran config script will need access to the C library.
export LD_LIBRARY_PATH="$AmberClassicHome/lib:$LD_LIBRARY_PATH"
printf "Configuring the NetCDF Fortran interface..."
make clean > /dev/null 2>&1
./configure CC="$cc" CFLAGS="-fPIC" \
LDFLAGS="-L$AmberClassicHome/lib $ldflags" \
CPPFLAGS="-I$AmberClassicHome/include" \
FC="$fc" FCFLAGS="" \
F77="$fc" FFLAGS="-fPIC" --disable-shared --disable-doxygen \
--prefix=$AmberClassicHome >> ../netcdf_f.config.log 2>&1
ncerror=$?
if [ $ncerror -gt 0 ]; then
echo "Error: NetCDF configure failed! Check netcdf_f.config.log"
exit 1
else
echo "OK"
fi
# Build the fortran interface
printf "Compiling the NetCDF Fortran interface..."
make install > ../netcdf_f.compile.log 2>&1
if [ $? -ne 0 ]; then
echo "Error: NetCDF Fortran compile failed! Check netcdf_f.compile.log"
exit 1
else
echo "OK"
fi
cd ../..
else
echo "Using the existing netcdf libraries"
fi
#--------------------------------------------------------------------------
# Configure and build FFTW3:
#--------------------------------------------------------------------------
if [ "$conda" == "yes" ]; then
flibs_fftw="-L$CONDA_PREFIX/lib $flibs_fftw"
echo "using fftw libraries from conda-forge"
elif [ "$mkl" == "yes" ]; then
lapack=skip
blas=skip
# Determine MKL home directory
mklroot=''
if [ ! -z "$MKLROOT" ] ; then
mklroot=$MKLROOT
elif [ ! -z "$MKL_HOME" ] ; then
mklroot=$MKL_HOME
fi
echo ""
if [ ! -z "$mklroot" ] ; then
echo "Using MKL for BLAS/LAPACK/FFTW in $mklroot"
else
echo "Using MKL for BLAS/LAPACK/FFTW"
fi
mklinc=-I$mklroot/include/fftw
# Determine how we are linking MKL: hard-wire to 'line' for now
link_type='line'
if [ "$compiler" = "oneapi" ]; then
link_type='openmpi'
fi
# Always link static version of MKL - just easier from an end
# user perspective.
if [ "$link_type" = 'line' ] ; then
# ----- Link line advisor style. Requires MKLROOT ------
if [ -z "$mklroot" ] ; then
echo "Error: MKLROOT/MKL_HOME not set." > /dev/stderr
exit 1
fi
mkll="$mklroot/lib"
mklinterfacelayer='libmkl_intel_lp64.a'
# Determing threading interface if necessary
mklthread="$mkll/libmkl_sequential.a"
mklomp=''
if [ "$openmp" = 'yes' ] ; then
mklthread="$mkll/libmkl_gnu_thread.a"
mklomp='-lgomp'
fi
# Set link flags
if [ "$gnuld" = 'yes' ]; then
echo "GNU linker assumed."
flibs_mkl="-Wl,--start-group $mkll/$mklinterfacelayer $mklthread $mkll/libmkl_core.a -Wl,--end-group $mklomp -lpthread"
else
echo "Non-GNU linker assumed."
flibs_mkl="-L$mkll $mkll/$mklinterfacelayer $mklthread $mkll/libmkl_core.a -lpthread"
fi
# GNU compilers with MKL requires -ldl
if [ "$compiler" = 'gnu' ]; then
flibs_mkl="$flibs_mkl -ldl"
fi
else
# ----- Use simple flag for Intel compilers ------------
if [ "$openmp" = 'yes' ]; then
flibs_mkl='-qmkl'
else
flibs_mkl='-qmkl=sequential'
fi
fi
flibs_la="-larpack $flibs_mkl"
else
# ----- build fftw libraries from source: -----------
if [ ! -s "lib/libfftw3.a" ] || \
[ "$mpi" == "yes" -a ! -s "lib/libfftw3_mpi.a" ] || \
[ "$cc" != "clang" -a "$openmp" == "yes" -a ! -s "lib/libfftw3_omp.a" ]; then
if [ "$openmp" == "no" -o "$cc" == "clang" ]; then
enableomp=""
else
enableomp="--enable-openmp"
fi
# enable_sse="--enable-sse=no --enable-sse2=no --enable-avx=no"
enable_sse="--enable-sse2=yes --enable-avx=yes"
printf "\nConfiguring fftw-3.3 with $cc and $fc..."
cd src/fftw-3.3 && \
./configure --disable-doc --prefix=$AmberClassicHome \
--libdir=$AmberClassicHome/lib $enableomp $fftw_flags \
--enable-static $enable_sse MPICC="$mpicc" \
CC="$cc" CFLAGS="$gccsys $optflags -fPIC" \
F77="$fc" FFLAGS="$optflags -fPIC" \
FLIBS="$flibs_arch" > fftw3_config.log 2>&1
ncerror=$?
if [ $ncerror -gt 0 ]; then
echo "Error: FFTW configure returned $ncerror"
exit 1
else
echo "OK"
fi
# Build FFTW3
printf "Compiling the FFTW3 interface..."
make install > fftw3.compile.log 2>&1
if [ $? -ne 0 ]; then
printf "\nError: FFTW3 compile failed.\n"
exit 1
else
printf "OK\n"
fi
cd ../..
else
echo "Using the existing fftw3 libraries"
fi
fi
#--------------------------------------------------------------------------
# Configure and build Boost subset:
#--------------------------------------------------------------------------
if [ "$boost" == "yes" -o "$boost" == "system" ]; then
if [ "$conda" == "yes" ]; then
boostlib="-L$CONDA_PREFIX/lib -lboost_program_options -lboost_iostreams"
echo "using boost libraries from conda-forge"
elif [ "$boost" == "system" ]; then
echo "using boost libraries from system"
elif [ ! -s "lib/libboost_iostreams.a" ]; then
printf "\nInstalling boost subset: $boostlib\n"
cd src/boost_1_86_0
make install_boost
cd ../..
else
echo "Using the existing boost libraries"
fi
fi
#---------------------------------------------------------------------!
# Check for CUDA tool kit and compiler !
#---------------------------------------------------------------------!
# this function sets the user defined cuda architecture flags, if specified
set_uspec_arch(){
for carch in $cuda_arch; do
case "$carch" in
kepler)
echo "Configuring for SM3.0"
cuda_arch_flags="$cuda_arch_flags $sm30flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants';;
maxwell)
echo "Configuring for SM5.0"
cuda_arch_flags="$cuda_arch_flags $sm50flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants';;
pascal)
echo "Configuring for SM6.0"
cuda_arch_flags="$cuda_arch_flags $sm60flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants';;
volta)
echo "Configuring for SM7.0"
cuda_arch_flags="$cuda_arch_flags $sm70flags"
if [ `echo "$cudaversion < 10.0 "| bc` -gt 0 ]; then
cuda_dc_flags='-Xptxas --disable-optimizer-constants'
fi
;;
turing)
echo "Configuring for SM7.5"
cuda_arch_flags="$cuda_arch_flags $sm75flags";;
ampere)
echo "Configuring for SM8.0 and SM8.6"
cuda_arch_flags="$cuda_arch_flags $sm80flags $sm86flags";;
ada)
echo "Configuring for SM8.9"
cuda_arch_flags="$cuda_arch_flags $sm89flags";;
esac
done
}
if [ "$cuda" = 'yes' ]; then
if [ -z "$CUDA_HOME" ]; then
echo "Error: CUDA_HOME environment variable is not set."
echo "Please make sure CUDA toolkit is loaded."
exit 1
fi
if [ ! -x "$CUDA_HOME/bin/nvcc" ]; then
echo "Error: nvcc compiler is not available in $CUDA_HOME/bin/"
exit 1
fi
if [ -z "$NVCC" ]; then nvcc="$CUDA_HOME/bin/nvcc"; else nvcc="$NVCC"; fi
#SM8.9 = 4090
sm89flags='-gencode arch=compute_89,code=sm_89'
#SM8.6 = 3080, 3090(?)
sm86flags='-gencode arch=compute_86,code=sm_86'
#SM8.0 = A100
sm80flags='-gencode arch=compute_80,code=sm_80'
#SM7.5 = RTX20xx, Tesla T4, Quadro RTX, RTX Titan
sm75flags='-gencode arch=compute_75,code=sm_75'
#SM7.0 = V100, Titan V
sm70flags='-gencode arch=compute_70,code=sm_70'
#SM6.0 = GP100 / P100 = DGX-1
sm60flags='-gencode arch=compute_60,code=sm_60'
#SM5.0 = M40
sm50flags='-gencode arch=compute_50,code=sm_50'
#SM3.5 = Kepler (late)
sm35flags='-gencode arch=compute_35,code=sm_35'
cudaversion=`$nvcc --version | awk '/release/{print substr($5,1,4)}'`
if [ "${cudaversion:0:2}" = "12" ]; then
echo "CUDA Version $cudaversion detected"
if [ "$uspec_arch" = 'true' ]; then
set_uspec_arch
else
echo "Configuring for SM5.0,6.0,7.0,7.5,8.0,8.6,8.9"
cuda_arch_flags="$sm50flags $sm60flags $sm70flags $sm75flags $sm80flags $sm86flags $sm89flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants'
fi
elif [ "${cudaversion:0:2}" = "11" ]; then
echo "CUDA Version $cudaversion detected"
if [ "$uspec_arch" = 'true' ]; then
set_uspec_arch
else
echo "Configuring for SM3.5,5.0,6.0,7.0,7.5,8.0"
cuda_arch_flags="$sm35flags $sm50flags $sm60flags $sm70flags $sm75flags $sm80flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants'
fi
elif [ "${cudaversion:0:2}" = "10" ]; then
echo "CUDA Version $cudaversion detected"
if [ "$uspec_arch" = 'true' ]; then
set_uspec_arch
else
echo "Configuring for SM3.5,5.0,6.0,7.0,7.5"
cuda_arch_flags="$sm35flags $sm50flags $sm60flags $sm70flags $sm75flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants'
fi
elif [ "${cudaversion:0:1}" = "9" ]; then
echo "CUDA Version $cudaversion detected"
if [ "$uspec_arch" = 'true' ]; then
set_uspec_arch
else
echo "Configuring for SM3.5,5.0,6.0,7.0"
cuda_arch_flags="$sm35flags $sm50flags $sm60flags $sm70flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants'
fi
elif [ "${cudaversion:0:1}" = "8" ]; then
echo "CUDA Version $cudaversion detected"
if [ "$uspec_arch" = 'true' ]; then
set_uspec_arch
else
echo "Configuring for SM3.5,5.0,6.0,7.0"
cuda_arch_flags="$sm35flags $sm50flags $sm60flags $sm70flags"
cuda_dc_flags='-Xptxas --disable-optimizer-constants'
fi
else
echo "Error: Unsupported CUDA version $cudaversion detected. "
echo " requires at least CUDA version 8.0 "
exit 1
fi
if [ "$cuda_prec" = 'SPFP' ]; then
prec_model=-DCUDA_PRECISION=Single
printf "Using SPFP precision model\n"
else
prec_model=-DCUDA_PRECISION=Double
printf "Using DPFP precision model\n"
fi
fi
#--------------------------------------------------------------------------
# create the config.h file:
#--------------------------------------------------------------------------
cat <<EOF > config.h
# AmberClasic configuration file.
# Created on `date` via $command
#
# Compilers:
# $cc : $cc_version
# $fc : $fc_version
###############################################################################
# (1) Location of the installation
BASEDIR=$AmberClassicHome
BINDIR=\$(BASEDIR)/bin
LIBDIR=\$(BASEDIR)/lib
INCDIR=\$(BASEDIR)/include
DATDIR=\$(BASEDIR)/dat
LOGDIR=\$(BASEDIR)/logs
###############################################################################
# (2) Flags that depend on OS type
SHARED_SUFFIX=$shared_suffix
MAKE_SHARED=$make_shared
LM=$lm
###############################################################################
# (3) specify some library options:
NETCDFLIBF=$netcdflibf
BOOSTLIB=$boostlib
LAPACK=$lapack
BLAS=$blas
###############################################################################
# (4) C compilers:
CC=$cc
CXX=$cxx
CFLAGS=$gccflags $clangf $clangflags $ompcflag $inc $gcc10c $fpic $debug $conda_incflags $xblasflag
CNOOPTFLAGS=-g -O0
COPTFLAGS=$optflags
# (FLIBS is for C/NAB codes)
FLIBS= $ompcflag -lsff -lnabc $flibs_la $netcdflib $netcdflibf $ciflib $flibs_arch $ldflags $lm
###############################################################################
# (5) Fortran compiler:
FC=$fc
FFLAGS=$clangf $inc $optmkl $ompflag $mpiflag $gcc10f $fpic $longlines $plumed_def $conda_incflags $mklinc
FLIBSF=-lrism -lxray $flibs_fftw $flibs_la $plumed_load
FNOOPTFLAGS= -O0 -g
FOPTFLAGS=$optflags
SHORT_ENE=$short_ene
###############################################################################
# (6) other flags:
LDFLAGS=$ldflags $lm
AR= ar rv
RANLIB=ranlib
MV=mv
CP=cp
MAKE=make --no-print-directory
SFX=$sfx
VB=$verbose
INSTALLTYPE=$installtype
FLEX=flex
BISON=bison
MOFT=$moft
ARPACK=$arpack
MDGXLIBS=$flibs_fftw $flibs_la $netcdflib
# CUDA:
CUDAFLAGS=$cudafflags $prec_model $cuda_arch_flags $cuda_dc_flags
CUDAFFLAGS=$cudafflags
NVCC_CFLAGS=-Wno-deprecated-gpu-targets $clangf $inc $fpic $debug $conda_incflags
# PLUMED related variables:
PLUMED_INCLUDE_FILE=
PLUMED_LOAD=Plumed.o
PLUMED_DEPENDENCIES=Plumed.o
EOF
#--------------------------------------------------------------------------
# create the config_testing.h file:
#--------------------------------------------------------------------------
cat <<EOF > config_testing.h
# AmberClasic configuration file for testing.
INSTALLTYPE=$installtype
EOF
printf "\nThe next step is to type 'make clean && make install'\n\n"
exit 0