/
configure
executable file
·1724 lines (1540 loc) · 40.6 KB
/
configure
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
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env bash
###
# This is not a real configure script. It simply
# 1) tries to determine the specific machine you're on by hpcname
# 2) creates make_config which has the vars that Makefile needs that hpcname
# 3) creates config.h with system specific values needed in code sections
# 4) lets you override the above (careful)
# 5) does some simple tests to see if the choices work
#
# If you want to properly autoconf this code I think it would be a good idea
# and I'd be willing to help. It seems very tricky to me. See hpcname - DES
###
###
# options
###
function usage {
cat <<EOF
Usage: configure [options]
Options: [defaults in brackets after descriptions]
Configuration:
--help
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--prefix=PREFIX
--logdir=PATH
--with-dynwrap wrap with dynamic func pointers
--with-initfini test MPI_Init/Finalize only
--with-hpcname=[franklin|datastar|ranger|bassi..] configure hpcname=X [guessed]
--with-arch=[POWER|X86|AMD64|BGL|XT3|XT4|ALTIX..] configure arch=X [guessed]
--with-os=[LINUX|AIX|NEC|BGL|UNICOS..] configure os=X [guessed]
--with-cpu=[NEHALEM|PENTIUM_M|PWR4|PWR5|OPTERTON|WOODCREST|CORES2DUO..] configure cpu=X [guessed]
--switch=[COLONY|FEDERATION|PROC_IB0|..] configure switch=X [guessed]
--with-compiler=[GNU|IBM|INTEL|PATH|PGI|CRAY..] configure compiler=X [guessed]
--with-papiroot=dir use papi include/libs in dir
--with-hpm=[PAPI|PMAPI|DISABLED..] configure hpm=X [guessed]
--with-io=[posix|mpiio] configure io=X [guessed]
--with-stimer=[RDTSC|READREALTIME|GTOD...] use serial timer=X [guessed]
--with-gtimer=[WTIME|RDTSC|GTOD...] use global timer=X [guessed]
--with-ipmkeyfile=file use file for call configuration
--with-testtasks=n use n tasks in tests (default 2)
--without-log don't save profiles to disk
--with-ipm-start=[on|off] ipm is on/off by default
the hpcname utility shows the full range of options for the above
arch, os, cpu, switch, and compiler options. Try "hpcname -h"
Some influential environment variables:
CC C compiler command
CFLAGS C compiler flags
FFLAGS Fortran compiler flags
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have
headers in a nonstandard directory <include dir>
CPP C preprocessor
CXX C++ compiler command
F77 Fortran 77 compiler command
F90 Fortran 90 compiler command
LINKER Command to link serial executables
MPILINKER Command to link MPI executables
Use these variables to override the choices made by 'configure' or to help
it to find libraries and programs with nonstandard names/locations.
EOF
exit 0
}
###
# Defaults
###
if [ "$HOST" == "" ] ; then HOST=`hostname` ; fi
if [ "$BUILD_ROOT" == "" ] ; then BUILD_ROOT=$PWD ; fi
if [ "$TEST_DIR" == "" ] ; then TEST_DIR="$PWD/.test" ; fi
if [ "$AR" == "" ] ; then AR="ar" ; fi
if [ "$RM" == "" ] ; then RM="rm" ; fi
if [ "$LD" == "" ] ; then LD="ld" ; fi
IPM_KEYFILE="$PWD/ipm_key" ;
#IPM_LOG_DIR=./;
PREFIX=/usr/local/packages/ipm
# By default this is now read at runtime
# mainly because too many machines out there have a different cpu
# on the login node and the compute nodes.
TICKCHECK=no;
CONFIG_H=$BUILD_ROOT/include/config.h
CONFIG_M=$BUILD_ROOT/make_config
CONFIG_LOG=$BUILD_ROOT/config.log
rm -rf $CONFIG_LOG
if [ "$HPCNAME" == "" ]; then
HPCNAME=`./bin/hpcname -n`
fi
if [ "$WRAPMAKER" == "" ]; then WRAPMAKER="$PWD/bin/make_wrappers" ; fi
###
# First pass through arguments
###
for opt in "$@" ; do
case "$opt" in
-*=*) arg=`echo "$opt" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) arg= ;;
esac
###
# Unset variables that are known to exist on some machines that have
# name conflicts with the variables in this script
###
case "$opt" in
--help) usage ;;
--with-hpcname=*) HPCNAME=$arg ;;
--with-arch=*) ARCH=$arg ;;
--with-switch=*) SWITCH=$arg ;;
--with-os=*) OS=$arg ;;
--with-cpu=*) CPUIPM=$arg ;;
--with-compiler=*) COMPILER=$arg ;;
--with-hpm=*) TRY_HPM=$arg ;;
--with-ipmkeyfile=*) IPM_KEYFILE=$arg ;;
--with-testtasks=*) TEST_TASKS=$arg ;;
--with-ipm-start=*) IPM_START_STATE=$arg ;;
--with-papiroot=*) TRY_HPM="PAPI" ; TRY_HPM_CFLAGS="-I$arg/include" ; TRY_HPM_LDFLAGS="-L$arg/lib" ;;
--prefix=*) PREFIX="$arg" ;;
--without-log*) CFLAGS="$CFLAGS -DIPM_DISABLE_LOG" ;;
--with-stimer=*) TRY_STIMER=$arg ;;
esac
done
###
# Guessed items
###
if [ "$HPCNAME" != "unknown" ] ; then
if [ "$CPUIPM" == "" ]; then CPUIPM=`./bin/hpcname --cpu` ; fi
if [ "$ARCH" == "" ]; then ARCH=`./bin/hpcname --arch` ; fi
if [ "$OS" == "" ]; then OS=`./bin/hpcname --os` ; fi
if [ "$SWITCH" == "" ]; then SWITCH=`./bin/hpcname --switch` ; fi
if [ "$COMPILER" == "" ]; then COMPILER=`./bin/hpcname --compiler` ; fi
if [ "$IPM_LOG_DIR" == "" ]; then IPM_LOG_DIR=`./bin/hpcname --logdir` ; fi
if [ "$IPM_KEYFILE" == "" ]; then IPM_KEYFILE="$PWD/ipm_key" ; fi
if [ "$TICKCHECK" == "" ] ; then TICKCHECK="yes" ; fi
fi
if [ "$TEST_TASKS" == "" ]; then TEST_TASKS=`./bin/hpcname --testtasks` ; fi
if [ "$TEST_TASKS" == "" ]; then TEST_TASKS="2" ; fi
MACH=$OS"_"$ARCH"_"$COMPILER
# turn of EXEC info by default - it breaks in too many places
CFLAGS="$CFLAGS -DIPM_DISABLE_EXECINFO"
if [ "$ARCH" == "XT3" -o "$ARCH" == "XT4" -o "$ARCH" == "XT5" ] ; then
CFLAGS="$CFLAGS -DIPM_DISABLE_PWENT"
fi
###
# Things we know about compilers {
###
if [ "$COMPILER" == "GNU" ] ; then
if [ "$CC" == "" ]; then TRY_CC="gcc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="g++" ; fi
if [ "$F77" == "" ]; then TRY_F77="gfortran" ; fi
if [ "$F90" == "" ]; then TRY_F90="gfortran" ; fi
fi
if [ "$COMPILER" == "PATH" ] ; then
if [ "$CC" == "" ]; then TRY_CC="pathcc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="pathCC" ; fi
if [ "$F77" == "" ]; then TRY_F77="pathf77" ; fi
if [ "$F90" == "" ]; then TRY_F90="pathf90" ; fi
fi
if [ "$COMPILER" == "PGI" ] ; then
if [ "$CC" == "" ]; then TRY_CC="pgcc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="pgCC" ; fi
if [ "$F77" == "" ]; then TRY_F77="pgf90" ; fi
if [ "$F90" == "" ]; then TRY_F90="pgf90" ; fi
fi
if [ "$COMPILER" == "INTEL" ] ; then
if [ "$CC" == "" ]; then TRY_CC="icc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="icc" ; fi
if [ "$F77" == "" ]; then TRY_F77="ifort" ; fi
if [ "$F90" == "" ]; then TRY_F90="ifort" ; fi
if [ "$F77" == "" ]; then TRY_MPIF77="ifort -lmpi" ; fi
if [ "$F90" == "" ]; then TRY_MPIF90="ifort -lmpi" ; fi
fi
if [ "$COMPILER" == "IBM" ] ; then
if [ "$CC" == "" ] ; then TRY_CC="xlc" ; fi
if [ "$CXX" == "" ] ; then TRY_CXX="xlC" ; fi
if [ "$F77" == "" ] ; then TRY_F77="xlf" ; fi
if [ "$F90" == "" ] ; then TRY_F90="xlf90" ; fi
fi
###
# Things we know about MACH triples {
###
if [ "$MACH" == "AIX_IBMSP_IBM" ] ; then
if [ "$MPICC" == "" ] ; then TRY_MPICC="mpcc_r" ; fi
if [ "$MPIF77" == "" ] ; then TRY_MPIF77="mpxlf_r" ; fi
if [ "$MPIF90" == "" ] ; then TRY_MPIF77="mpxlf90_r" ; fi
IPM_LIB_OPTS=" -nofort";
CFLAGS="$CFLAGS -I/usr/lpp/ppe.poe/include "
fi
if [ "$MACH" == "AIX_aix-5.2_IBM" -o "$MACH" == "AIX_IBMSP_IBM" ] ; then
MPICC="mpcc_r"
MPIF77="mpxlf_r"
MPIF77="mpxlf90_r"
IPM_LIB_OPTS=" -nofort";
fi
if [ "$MACH" == "LINUX_BGL_BLRTSIBM" ] ;then
if [ "$CC" == "" ]; then TRY_CC="blrts_xlc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="blrts_xlC" ; fi
if [ "$F77" == "" ]; then TRY_F77="blrts_xlf" ; fi
if [ "$F90" == "" ]; then TRY_F90="blrts_xlf90" ; fi
if [ "$MPICC" == "" ]; then TRY_MPICC="mpcc_r" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="mpxlf_r" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF77="mpxlf90_r" ; fi
fi
if [ "$MACH" == "BLRTS_linux-sles10-ppc64_IBM" ] ;then
if [ "$CC" == "" ]; then TRY_CC="xlc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="xlC" ; fi
if [ "$F77" == "" ]; then TRY_F77="xlf" ; fi
if [ "$F90" == "" ]; then TRY_F90="xlf90" ; fi
if [ "$MPICC" == "" ]; then TRY_MPICC="mpixlc_r" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="mpixlf77_r" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF77="mpixlf90_r" ; fi
fi
if [ "$MACH" == "NEC_SX6_NEC" ] ;then
if [ "$CC" == "" ]; then TRY_CC="sxcc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="sxCC" ; fi
if [ "$F77" == "" ]; then TRY_F77="sxf90" ; fi
if [ "$F90" == "" ]; then TRY_F90="sxf90" ; fi
if [ "$MPICC" == "" ]; then TRY_MPICC="sxmpicc" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="sxmpif90" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF77="sxmpif90" ; fi
if [ "$AR" == "" ]; then TRY_AR="sxar"; fi
fi
if [ "$MACH" == "UNICOS_CRAYX1_CRAY" ] ; then
if [ "$CC" == "" ]; then TRY_CC="cc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="CC" ; fi
if [ "$F77" == "" ]; then TRY_F77="ftn" ; fi
if [ "$F90" == "" ]; then TRY_F90="ftn" ; fi
if [ "$MPICC" == "" ]; then TRY_MPICC="mpicc" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="mpif90" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF90="mpif90" ; fi
fi
if [ "$MACH" == "LINUX_ALTIX_INTEL" ] ; then
if [ "$MPICC" == "" ]; then TRY_MPICC="mpicc" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="mpif90" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF90="mpif90" ; fi
fi
if [ "$MACH" == "CNL_XT4_PGI" ] ; then
if [ "$CC" == "" ]; then TRY_CC="cc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="CC" ; fi
if [ "$F77" == "" ]; then TRY_F77="ftn" ; fi
if [ "$F90" == "" ]; then TRY_F90="ftn" ; fi
if [ "$MPICC" == "" ]; then TRY_MPICC="cc" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="ftn" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF90="ftn" ; fi
fi
if [ "$MACH" == "LINUX_XT4_PGI" -o "$MACH" == "LINUX_XT3_PGI" ] ; then
if [ "$CC" == "" ]; then TRY_CC="cc" ; fi
if [ "$CXX" == "" ]; then TRY_CXX="CC" ; fi
if [ "$F77" == "" ]; then TRY_F77="ftn" ; fi
if [ "$F90" == "" ]; then TRY_F90="ftn" ; fi
if [ "$MPICC" == "" ]; then TRY_MPICC="cc" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="ftn" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF90="ftn" ; fi
fi
if [ "$MACH" == "BSD_X86_GNU" ] ; then
if [ "$MPICC" == "" ]; then TRY_MPICC="mpicc" ; fi
if [ "$MPIF77" == "" ]; then TRY_MPIF77="mpif77" ; fi
if [ "$MPIF90" == "" ]; then TRY_MPIF90="mpif90" ; fi
fi
if [ "$MACH" == "LINUX_linux-rhel4-x86_64_INTEL" ] ; then
if [ "$MPICC" == "" ]; then MPICC="mpicc" ; fi
if [ "$MPIF77" == "" ]; then MPIF77="mpif90" ; fi
if [ "$MPIF90" == "" ]; then MPIF77="mpif90" ; fi
fi
###
# }
###
###
# Things we know about specific machines {
###
if [ "$HPCNAME" == "jacquard" ] ; then
if [ "$TRY_HPM_CFLAGS" == "" ]; then TRY_HPM_CFLAGS="-I/usr/common/usg/papi/default/include" ; TRY_HPM_LDFLAGS="-L/usr/common/usg/papi/default/lib -lpapi" ; fi
if [ "$MPIF77" == "" ]; then MPIF77="mpif90" ; fi
if [ "$MPIF90" == "" ]; then MPIF77="mpif90" ; fi
fi
if [ "$HPCNAME" == "kraken" ] ; then
CFLAGS="$CFLAGS -DIPM_DISABLE_PWENT -DIPM_DISABLE_EXECINFO "
PAPIROOT="/opt/xt-tools/papi/3.6.2/v23/linux/";
TRY_HPM_CFLAGS=$PAPI_INCLUDE_OPTS;
TRY_HPM_LDFLAGS=$PAPI_POST_LINK_OPTS;
CPUIPM=OPTERON;
fi
if [ "$HPCNAME" == "franklin" ] ; then
CFLAGS="$CFLAGS -DIPM_DISABLE_PWENT -DIPM_DISABLE_EXECINFO -DWRAP_FORTRAN -DCRAY_GPFS_BUG";
if [ "$TRY_HPM_CFLAGS" == "" ]; then PAPIROOT="/opt/xt-tools/papi/default/xt-cnl/"; TRY_HPM_CFLAGS="-I$PAPIROOT/include" ; TRY_HPM_LDFLAGS="-L$PAPIROOT/lib64 -lpapi" ; fi
fi
if [ "$HPCNAME" == "hopper" ] ; then
CFLAGS="$CFLAGS -DIPM_DISABLE_PWENT -DIPM_DISABLE_EXECINFO -DWRAP_FORTRAN -DCRAY_GPFS_BUG";
TRY_HPM_LDFLAGS=$PAPI_POST_LINK_OPTS;
TRY_HPM_CFLAGS=$PAPI_INCLUDE_OPTS;
fi
if [ "$HPCNAME" == "bigben" ] ; then
CFLAGS="$CFLAGS -DIPM_DISABLE_PWENT -DIPM_DISABLE_EXECINFO "
if [ "$TRY_HPM_CFLAGS" == "" ]; then TRY_HPM_CFLAGS="$PAPI_INCLUDE_OPTS_XT" ; TRY_HPM_LDFLAGS="$PAPI_LD_OPTS_XT" ; fi
# on bigben we cross compile - so cannot measure clock speed
TICKCHECK="no"
fi
if [ "$HPCNAME" == "pople" ] ; then
PAPI_RPATH=`echo $PAPI_LIB | sed -e s/-L//| sed -e s/-lpapi//`
if [ "$TRY_HPM_CFLAGS" == "" ]; then TRY_HPM_CFLAGS="$PAPI_INC" ; TRY_HPM_LDFLAGS="$PAPI_LIB -Wl,-rpath=$PAPI_RPATH" ; fi
CFLAGS="$CFLAGS -fPIC "
TRY_MPIF77="ifort"
TRY_MPIF90="ifort"
TRY_MPICC="icc"
LDFLAGS="-lmpi"
TICKCHECK="no"
fi
if [ "$HPCNAME" == "jaguar" ] ; then
if [ "$TRY_HPM_CFLAGS" == "" ]; then TRY_HPM_CFLAGS="$PAPI_INCLUDE_OPTS" ; TRY_HPM_LDFLAGS="$PAPI_POST_LINK_OPTS" ; fi
fi
if [ "$HPCNAME" == "ranger" ] ; then
if [ "$TRY_HPM_CFLAGS" == "" ]; then TRY_HPM_CFLAGS="-I$TACC_PAPI_INC" ; TRY_HPM_LDFLAGS="-L$TACC_PAPI_LIB -lpapi -lperfctr -lpfm" ; fi
# on ranger login nodes and compute have different clock speeds
# now added auto clockspeed get to IPM under linux
TICKCHECK="no"
fi
if [ "$HPCNAME" == "lonestar" ] ; then
TRY_HPM_CFLAGS="-I$TACC_PAPI_INC"
TRY_HPM_LDFLAGS="$TACC_PAPI_LIB/libpapi.so $TACC_PAPI_LIB/libperfctr.so"
CFLAGS=$CFLAGS" -DIPM_DISABLE_EXECINFO "
# on lonestar login nodes and compute have different clock speeds
TICKCHECK="no"
fi
if [ "$HPCNAME" == "abe" ] ; then
TRY_HPM=DISABLED
CFLAGS=$CFLAGS" -DIPM_DISABLE_EXECINFO"
fi
if [ "$HPCNAME" == "bgl-sdsc" ] ; then
CFLAGS=$CFLAGS" -I/bgl/BlueLight/ppcfloor/bglsys/include -DIPM_DISABLE_PWENT -DIPM_DISABLE_SINGLELOG -DIPM_DISABLE_EXECINFO -qarch=440 -qtune=440 -DLINUX_BGL "
fi
if [ "$HPCNAME" == "bgp-anl" ] ; then
TRY_MPICC=mpicc
CFLAGS=$CFLAGS" -DIPM_DISABLE_PWENT -DIPM_DISABLE_SINGLELOG -DIPM_DISABLE_EXECINFO -I/bgsys/drivers/ppcfloor/arch/include/"
TRY_HPM_CFLAGS="-I/soft/apps/current/papi/include"
TRY_HPM_LDFLAGS="-L/soft/apps/current/papi/lib -lpapi /bgsys/drivers/ppcfloor/runtime/SPI/libSPI.cna.a -lpthread"
#TRY_HPM_LDFLAGS="-L/soft/apps/current/papi/lib -lpapi -lpthread"
fi
###
###
# }
###
CFLAGS=$CFLAGS" -I$BUILD_ROOT/include "
LDFLAGS=$LDFLAGS" -L$BUILD_ROOT/lib "
###
# Setup Makefile's make_config and buildtime include/config.h
###
if [ ! -f "VERSION" ] ; then
echo "unknown version in VERSION file";
echo "(this file should contain the current source version)";
exit;
else
IPM_VERSION=`cat VERSION`
fi
if [ -f "$CONFIG_M" ] ; then
$RM $CONFIG_M ;
echo "#this file is generated by ./configure" > $CONFIG_M
echo "IPM_VERSION=$IPM_VERSION" >> $CONFIG_M
fi
if [ -f "$CONFIG_H" ] ; then
$RM $CONFIG_H ;
fi
echo configuring for $HPCNAME w/ OS=$OS ARCH=$ARCH COMPILER=$COMPILER CPU=$CPUIPM
###
# Write config.h
###
cat >> $CONFIG_H <<EOF
#define IPM_VERSION "$IPM_VERSION"
#define IPM_HPCNAME "$HPCNAME"
#define OS_$OS
#define ARCH_$ARCH
#define ${OS}_${ARCH}
#define CPU_${CPUIPM}
#define COMPILER $COMPILER
#define IPM_LOG_DIR "$IPM_LOG_DIR"
EOF
# runs bin/make_wrappers with the -prep flag which stops early and only makes config.h
$WRAPMAKER -prep $IPM_KEYFILE >> $CONFIG_H
###
# Run some compiler tests {
###
for tag in $TRY_CC $CC cc xlc sxcc pgcc ; do
## compile a simple C program {
TEST_NAME="simplec"
echo -n "checking whether the C compiler ( $tag ) works..."
$RM -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
double foobar() {return -1.0;}
int main(int argc, char *argv[]) {
foobar();
; return 0; }
EOF
cat >> run <<EOF
#!/bin/sh -x
$tag $CFLAGS $LDFLAGS $TEST_NAME.c -o $TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
CONF_CC=$tag
break
cd $BUILD_ROOT
else
echo "no"
fi
## }
cd $BUILD_ROOT
done
if [ "$CONF_CC" == "" ] ; then
echo "can't find a C compiler"
exit
else
CC=$CONF_CC
fi
for tag in $TRY_CXX $CXX cxx xlC sxCC pgCC g++ ; do
## compile a simple C++ program {
TEST_NAME="simplecxx"
echo -n "checking whether the C++ compiler ( $tag ) works..."
$RM -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.cc <<EOF
#include <iostream>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
inline int sub1(int a);
int main() {
cout << " Hello world. I am a C++ program." << endl;
// sub1(1);
return 0;
}
int sub1(int a) {
printf("%d\n", a);
return 1;
}
EOF
cat >> ./run <<EOF
#!/bin/sh -x
$tag $CFLAGS $LDFLAGS ./$TEST_NAME.cc -o ./$TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
CXX=$tag
cd $BUILD_ROOT
break
else
echo "no"
fi
## }
cd $BUILD_ROOT
done
if [ "$CXX" == "" ] ; then
echo "can't find a C++ compiler"
exit
fi
for tag in $TRY_F77 $F77 f77 xlf sxf90 gfortran ifort ftn pgf77; do
## compile a simple F77 program {
TEST_NAME="simplef"
echo -n "checking whether the F77 compiler ( $tag ) works..."
$RM -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.f <<EOF
PROGRAM hello
100 format(a,f10.4)
INTEGER i
END
EOF
cat >> ./run <<EOF
#!/bin/sh -x
$tag $LDFLAGS ./$TEST_NAME.f -o ./$TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
F77=$tag
cd $BUILD_ROOT
break
else
echo "no"
fi
## }
cd $BUILD_ROOT
done
if [ "$F77" == "" ] ; then
echo "can't find a F77 compiler"
exit
fi
for tag in $TRY_F90 $F90 f90 xlf90 sxf90 gfortran ifort ftn g95 pgf90; do
## compile a simple F90 program {
TEST_NAME="simplef90"
echo -n "checking whether the F90 compiler ( $tag ) works..."
$RM -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.F <<EOF
PROGRAM hello
real*8, allocatable,target :: a(:)
INTEGER i
100 format(a,f10.4)
END
EOF
cat >> ./run <<EOF
#!/bin/sh -x
$tag $LDFLAGS ./$TEST_NAME.F -o ./$TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
F90=$tag
break
else
echo "no"
fi
## }
cd $BUILD_ROOT
done
if [ "$F90" == "" ] ; then
echo "can't find a F90 compiler"
exit
fi
cd $BUILD_ROOT
# } end of CC, F77, F90
###
# Figure out HPM if any {
###
## compile a simple C HPM program {
for tag in $TRY_HPM PAPI PMAPI DISABLED ; do
TEST_NAME="simplec_HPM_compile"
echo -n "determining how to compile HPM ($tag) C code ..."
$RM -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#ifdef HPM_PAPI
#include <papi.h>
#endif
#ifdef HPM_PMAPI
#include <pmapi.h>
#endif
#ifdef HPM_DISABLED
/* nothing to include */
#endif
int main(int argc, char *argv[]) {
return 0;
}
EOF
cat >> ./run <<EOF
#!/bin/sh -x
$CC -c -DHPM_$tag $TRY_HPM_CFLAGS $CFLAGS $LDFLAGS ./$TEST_NAME.c -o ./$TEST_NAME.o
if [ -f ./$TEST_NAME.o ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
HPM=$tag
HPM_CFLAGS=$TRY_HPM_CFLAGS
cd $BUILD_ROOT
break
else
echo "no"
fi
cd $BUILD_ROOT
done
if [ "$HPM" == "" ] ; then
echo "*** HPM include files not found, HPM disabled ***"
HPM="DISABLED"
TRY_HPM="DISABLED"
else
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
fi
## }
## link a simple C HPM program {
HPM_LDFLAGS=""
for tag in "$TRY_HPM_LDFLAGS -lpapi" "$TRY_HPM_LDFLAGS -lpapi -lperfctr" "$TRY_HPM_LDFLAGS -lpapi -lpfm" "-lpapi" "-lpapi -lperfctr" "-lpmapi" "${TRY_HPM_LDFLAGS}64 -lpapi -lperfctr" "${TRY_HPM_LDFLAGS}64 -lpapi" "${TRY_HPM_LDFLAGS}64 -lpapi -lpfm"; do
TEST_NAME="simplec_HPM_link"
echo -n "determining how to link HPM ($HPM) code ($tag)..."
rm -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#ifdef HPM_PAPI
#include <papi.h>
#endif
#ifdef HPM_PMAPI
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <pmapi.h>
#endif
int main(int argc, char *argv[]) {
int i,rv;
double x,y=0.1;
#ifdef HPM_PAPI
int retval, EventSet=PAPI_NULL;
long_long values[1];
PAPI_create_eventset(&EventSet);
PAPI_add_event(EventSet, PAPI_TOT_INS);
PAPI_start(EventSet);
for(i=0;i<1000000;i++) x+=y;
PAPI_read(EventSet, values);
PAPI_stop(EventSet, values);
#endif
#ifdef HPM_PMAPI
pm_prog_t pmapi_prog;
pm_info_t pmapi_info;
pm_groups_info_t pmapi_groups_info;
pm_data_t pmapi_data;
rv = pm_init(PM_VERIFIED, &pmapi_info, &pmapi_groups_info);
#endif
#ifdef HPM_DISABLED
/* nothing to include */
#endif
return 0;
}
EOF
cat >> ./run <<EOF
#!/bin/sh -x
$CC -DHPM_$HPM $HPM_CFLAGS $CFLAGS $LDFLAGS ./$TEST_NAME.c -o ./$TEST_NAME $tag
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
HPM_LDFLAGS=$tag
HPM_TEST=YES
break
else
echo "no"
fi
cd $BUILD_ROOT
done
if [ "$HPM_LDFLAGS" == "" ] ; then
echo "*** HPM link files not found, HPM disabled ***"
HPM="DISABLED"
TRY_HPM="DISABLED"
fi
## }
cd $BUILD_ROOT
# }
CFLAGS=$CFLAGS" $HPM_CFLAGS "
LDFLAGS=$LDFLAGS" $HPM_LDFLAGS "
cat >> $CONFIG_H << EOF
#define HPM_$HPM
EOF
###
# See if ipm.h works {
###
cd src
../bin/make_wrappers ../ipm_key
cd ..
## compile a simple serial C program w/ IPM macros {
TEST_NAME="simplec_IPM"
echo -n "checking for working IPM macros in ipm.h..."
rm -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <ipm.h>
double foobar() {return -1.0;}
int main(int argc, char *argv[]) {
ipm_taskdata task;
foobar();
; return 0; }
EOF
cat > ./run <<EOF
#!/bin/sh -x
$CC $CFLAGS -DIPM_STIME_SOURCE_IS_NULL $LDFLAGS ./$TEST_NAME.c -o ./$TEST_NAME $LDFLAGS
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
else
echo "no"
echo "see config.log for compiler errors."
exit 1
fi
cd $BUILD_ROOT
## }
## check for the gettimeofday wall timer {
TEST_NAME="gettimeofday_timer"
echo -n "checking for working gettimeofday..."
rm -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
#include <ipm.h>
double foobar() {sleep(1);}
double t1,t2;
int main(int argc, char *argv[]) {
ipm_taskdata task;
IPM_TIME_GTOD(t1);
foobar();
IPM_TIME_GTOD(t2);
if(t2-t1 < 0.0) {
return 1;
}
if(((t2-t1)-1.0)*((t2-t1)-1.0) < 0.1) {
return 0;
}
}
EOF
cat > ./run <<EOF
#!/bin/sh -x
$CC -DIPM_STIME_SOURCE_IS_GTOD $CFLAGS $LDFLAGS ./$TEST_NAME.c -o ./$TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
else
echo "no"
fi
cd $BUILD_ROOT
##}
## compile a simple serial C program w/ IPM serial timer {
for tag in $TRY_STIMER RTC READREALTIME RTS ITC RDTSC GTOD NULL; do
TEST_NAME="simplec_IPM_stimer"
echo -n "checking for working IPM serial timer macro ($tag) in ipm.h..."
rm -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
/* bogus time values are OK here since we are pre-callibration
we just want to know the type of clock to use */
#ifndef IPM_SECONDSPERTICK
#define IPM_SECONDSPERTICK 0.123
#endif
#include <ipm.h>
double foobar() {return -1.0;}
double t1,t2,iwall;
IPM_TICK_TYPE T1,T2;
int main(int argc, char *argv[]) {
ipm_taskdata task;
IPM_TIME_BRACKET(
foobar();
)
; return 0; }
EOF
cat >> ./run <<EOF
#!/bin/sh -x
$CC -DIPM_STIME_SOURCE_IS_${tag} $CFLAGS $LDFLAGS ./$TEST_NAME.c -o ./$TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
./run >> $CONFIG_LOG 2>&1
if [ $? == 0 ] ; then
echo "yes"
echo "#test $TEST_NAME end } " >> $CONFIG_LOG
STIME=$tag
cd $BUILD_ROOT
break
else
echo "no"
fi
cd $BUILD_ROOT
done
## }
cat >> $CONFIG_H << EOF
#define IPM_STIME_SOURCE_IS_$STIME
EOF
if [ "$STIME" == "RDTSC" -o "$STIME" == "ITC" ] ; then
if [ "$TICKCHECK" == "yes" ] ; then
## determine the number of clock ticks per second {
TEST_NAME="simplec_IPM_stimer_get"
echo -n "determining clock frequency..."
rm -rf $TEST_DIR ; mkdir $TEST_DIR ; cd $TEST_DIR
cat >> ./$TEST_NAME.c <<EOF
#include <stdio.h>
#include <stdlib.h>
/* bogus time values are OK here since we are pre-callibration
we just want to know the type of clock to use */
#ifndef IPM_SECONDSPERTICK
#define IPM_SECONDSPERTICK 0.123
#endif
#include <ipm.h>
int main(int argc, char *argv[]) {
double t1,t2;
IPM_TICK_TYPE T1,T2;
IPM_TIME_INIT
IPM_TIME_GTOD(t1);
IPM_TIME_BRACKET( sleep(1);)
IPM_TIME_GTOD(t2);
if (t2 <= t1) return 1;
if (T2 <= T1) return 2;
printf("%.12e\n",(t2-t1)/(T2-T1));
; return 0; }
EOF
cat >> ./run <<EOF
#!/bin/sh
$CC $CFLAGS $LDFLAGS ./$TEST_NAME.c -o ./$TEST_NAME
./$TEST_NAME
if [ -x ./$TEST_NAME ] ; then
exit 0
else
exit 1
fi
EOF
chmod +x ./run
echo "#test $TEST_NAME start {" >> $CONFIG_LOG
SECONDSPERTICK=`./run`