3 # Silly shorthand, used for source reorganization
10 echo 'Usage: build <target> <version> <options> [charmc-options ...]'
12 echo '<targets>: converse charm++ LIBS AMPI FEM bigemulator pose jade msa'
13 echo '<targets>: doc ps-doc pdf-doc html-doc'
17 echo ' charm++ compile Charm++ core only'
18 echo ' AMPI compile Adaptive MPI on top of Charm++'
19 echo ' FEM compile FEM framework'
20 echo ' LIBS compile additional parallel libraries with Charm++ core'
21 echo ' bigemulator build additional BigSim libraries'
22 echo ' pose build POSE parallel discrete event simulator'
23 echo ' jade build Jade compiler (auto-builds charm++, msa)'
24 echo ' msa build Multiphase Shared Arrays(MSA) library'
25 echo ' Tau build the TAU tracing library for generating TAU performance data'
26 echo ' ChaNGa compile Charm++ core and necessary libraries for ChaNGa'
30 ( cd $src ; ls -1 |
egrep -v '(^CVS)|(^shmem$)|(^mpi$)|(^sim$)|(^net$)|(^multicore$)|(^elan$)|(^util$)|(^common$)|(^uth$)|(^conv-mach-fix.sh$)|(^win32$)|(^win64$)|(^paragon$)|(^vmi$)|(^lapi$)|(^cell$)|(^gemini_gni$)|(^pami$)|(^template$)|(^cuda$)' |
pr -3 -t )
32 echo '<options>: compiler and platform specific options'
33 echo 'cc cc64 cxx kcc pgcc acc icc ecc gcc3 gcc4 mpcc pathscale clang'
34 echo 'help smp gm tcp vmi scyld clustermatic bigemulator ooc syncft mlogft causalft'
35 echo 'papi pthreads lam'
36 echo '--incdir --libdir --basedir --build-shared --destination --suffix -j'
40 echo 'For platform specific options, use help option:'
41 echo ' help platform specific help, e.g. ./build charm++ net-linux-x86_64 help'
43 echo 'Choose a compiler (only one option is allowed from this section):'
44 echo ' cc, cc64 For Sun WorkShop C++ 32/64 bit compilers'
45 echo ' cxx DIGITAL C++ compiler (DEC Alpha)'
46 echo ' kcc KAI C++ compiler'
47 echo " pgcc Portland Group's C++ compiler"
48 echo ' acc HP aCC compiler'
49 echo ' icc Intel C/C++ compiler for Linux IA32'
50 echo ' ecc Intel C/C++ compiler for Linux IA64'
51 echo ' gcc3 GNU GCC/G++ version 3'
52 echo ' gcc4 GNU GCC/G++ version 4 (only mpi-crayxt3)'
53 echo ' mpcc SUN Solaris C++ compiler for MPI'
54 echo ' pathscale Pathscale compiler suite'
55 echo ' clang Clang C/C++ compuler'
57 echo 'Choose a fortran compile (only one option is allowed from this section):'
58 echo ' g95 G95 at http://ww.g95.org'
59 echo ' absoft Absoft fortran compiler'
60 echo " pgf90 Portland Group\'s Fortran compiler"
61 echo ' ifc Intel Fortran compiler (older versions)'
62 echo ' ifort Intel Fortran compiler (newer versions)'
64 echo 'Platform specific options (choose multiple if apply):'
65 echo ' lam Use LAM MPI'
66 echo ' smp support for SMP, multithreaded charm on each node'
67 echo ' mpt use SGI Message Passing Toolkit (only for mpi version)'
68 echo ' gm use Myrinet for communication'
69 echo ' tcp use TCP sockets for communication (only for net version)'
70 echo ' ibverbs use the Infiniband OpenIB layer for communication (only for net-linux-x86_64 currently)'
71 echo " vmi use NCSA's VMI for communication (only for mpi version)"
72 echo ' scyld compile for Scyld Beowulf cluster based on bproc'
73 echo ' clustermatic compile for Clustermatic (support version 3 and 4) '
74 echo ' pthreads compile with pthreads Converse threads'
76 echo 'Advanced options:'
77 echo ' bigemulator compile for BigSim simulator'
78 echo ' ooc compile with out of core support'
79 echo ' syncft compile with Charm++ fault tolerance support'
80 echo ' mlogft compile with Charm++ message logging fault tolerance support'
81 echo ' papi compile with PAPI performance counter support (if any)'
83 echo "Charm++ dynamic libraries:"
84 echo " --no-build-shared don't build Charm++'s shared libraries (default)"
85 echo " --build-shared build Charm++ dynamic libraries (.so) "
87 echo 'Enable/disable features:'
88 src
/scripts
/configure
--help |
grep enable-
89 src
/scripts
/configure
--help |
grep with-
90 echo " --with-production build Charm++ with all optimizations for maximum performance, and disabling all above features"
92 echo 'Miscellaneous options:'
93 echo ' --incdir=DIR specify additional include path for compiler'
94 echo ' --libdir=DIR specify additional lib path for compiler'
95 echo ' --basedir=DIR shortcut for the above two - DIR/include and DIR/lib'
96 echo ' -j[N] parallel make, N is the number of paralle make jobs'
97 echo " --with-romio build AMPI with ROMIO library"
98 echo " --with-lbtime-type specify real type for the load balancing timers"
99 echo " --destination=DIR build Charm++ inside DIR, by default the destination is <version>"
100 echo " --suffix=DIR append DIR to the destination directory of the Charm++ build"
101 echo " --tau-makefile=FILE Specify which TAU stub makefile to use"
104 echo '<charmc-options>: normal compiler options e.g. -g -O -save -verbose'
109 echo "1. display all supported options for net-linux-x86_64 using 'help':"
110 echo ' ./build charm++ net-linux-x86_64 help'
111 echo '2. compile Charm++ on Linux with optimizations:'
112 echo ' ./build charm++ net-linux-x86_64 -O -DCMK_OPTIMIZE'
113 echo '3. compile Charm++ for Linux (32bit) clustermatic Beowulf cluster with Intel compiler:'
114 echo ' ./build charm++ net-linux clustermatic icc -O'
115 echo '4. compile Charm++ for IA64 Linux cluster with MPICH-GM:'
116 echo ' ./build charm++ mpi-linux-ia64 gm -O'
117 echo '5. compile Charm++ for Windows with VC++ (Cygwin required):'
118 echo ' ./build charm++ net-win32 -O'
119 echo '6. compile on IBM SP with MPI using parallel gmake, 4 jobs simultaneously:'
120 echo ' MAKE=gmake ./build charm++ mpi-sp -j4 -O # sh'
121 echo ' setenv MAKE gmake; ./build charm++ mpi-sp -j4 -O # csh'
122 echo '7. compile Charm++ with MPI that is installed at /usr/local/mpich:'
123 echo ' ./build charm++ mpi-linux --incdir /usr/local/mpich/include --libdir /usr/local/mpich/lib -O'
125 echo ' ./build charm++ mpi-linux --basedir /usr/local/mpich -O'
126 echo ' ./build Tau --tau-makefile=/usr/local/packages/TAU/x86_64/lib/Makefile.tau-mpi'
128 echo 'Note: This script:'
129 echo ' 1. Creates directories <destination> and <destination>/tmp'
130 echo ' 2. Copies src/scripts/Makefile into <destination>/tmp'
131 echo ' 3. Does a "make basics" in <destination>/tmp.'
132 echo ' 3. Does a "make -jN <target> <version> OPTS=<charmc-options>" in <destination>/tmp.'
133 echo "That's all build does. The rest is handled by the Makefile."
135 echo 'Thank you for using Charm++, please send questions or comments to '
136 echo 'Parallel Programming Lab at University of Illinois at Urbana-Champaign'
137 echo '(email: charm@cs.illinois.edu).'
141 echo "To get more detailed help, run ./build --help"
146 [ "x$QUIET" = "x--quiet" ] ||
echo $
*
150 for prefix
in cc conv-mach
152 str
="Supported compilers:"
153 [ "$prefix" = "conv-mach" ] && str
="Supported options:"
157 # echo "Checking for $prefix in $dir"
158 files
=`cd $dir; ls $prefix-*.h 2>/dev/null`
159 opts
="$opts "`echo $files | sed 's/'$prefix'-\([^.]*\).h/\1/g'`
162 rm -f $tmp; touch $tmp
167 opts
=`sort $tmp | uniq`
179 echo Error
: cannot
find $d!
188 [ -f $dir/cc-
$1.sh
] && return 1
196 [ -f $dir/conv-mach-
$1.h
] && return 1
199 echo "Error> option: $1 is not supported in this version!";
215 BUILD_SHARED
="" # default no shared lib
220 DESTINATION_SUFFIX
=""
224 [ "$1" = '--help' -o "$1" = '-h' ] && more=1 && syntax |
more && exit 1
225 [ $# -lt 2 ] && .
/smart-build.pl
&& exit 1
228 VERSION
=$1; BASEVERSION
=$1;
229 if test -f $src/$BASEVERSION/vdir_link
231 BASEVERSION
=`cat $src/$BASEVERSION/vdir_link`
233 ARCH
=`echo $1 | sed -e 's@-.*@@'`
240 OPT_DIRS
="$src/$BASEVERSION $src/$ARCH $src/common"
249 CheckDir
$dir/include
$dir/lib
250 LIBDIR
="$LIBDIR -L$dir/lib";
251 INCDIR
="$INCDIR -I$dir/include"
256 basedir
=`echo $1 | awk -F= '{print $2}'`
259 CheckDir
$dir/include
$dir/lib
260 LIBDIR
="$LIBDIR -L$dir/lib";
261 INCDIR
="$INCDIR -I$dir/include"
269 LIBDIR
="$LIBDIR -L$dir";
274 libdir
=`echo $1 | awk -F= '{print $2}'`
278 LIBDIR
="$LIBDIR -L$dir";
286 INCDIR
="$INCDIR -I$dir";
291 incdir
=`echo $1 | awk -F= '{print $2}'`
295 INCDIR
="$INCDIR -I$dir";
299 --no-build-shared|
--no-shared)
300 #BUILD_SHARED="-no-build-shared";
304 BUILD_SHARED
="-build-shared";
308 WITH_ROMIO
="true"; shift
311 WITH_PRODUCTION
="true"
315 CONFIG_OPTS
="$CONFIG_OPTS $1"
319 CONFIG_OPTS
="$CONFIG_OPTS $1"
328 DESTINATION
="`echo $1 | awk -F= '{print $2}'`"
333 DESTINATION_SUFFIX
="$1"
337 DESTINATION_SUFFIX
="`echo $1 | awk -F= '{print $2}'`"
345 TAU_MAKEFILE
=`echo $1 | awk -F= '{print $2}'`
349 MAKEOPTS
="$MAKEOPTS --quiet"
353 --enable-tracing|
--enable-tracing=*)
354 CONFIG_OPTS
="$CONFIG_OPTS $1"
359 CONFIG_OPTS
="$CONFIG_OPTS $1"
363 CONFIG_OPTS
="$CONFIG_OPTS $1"
367 PMAKENUM
=`echo $1 | awk -Fj '{print $2}'`
368 MAKEOPTS
="$MAKEOPTS -j $PMAKENUM"
372 # We hit a real compiler option (like -g, or -Dfoo),
373 # so just copy over all remaining options
376 OPTS
="$OPTS $1"; shift
383 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
387 # It specifies a compiler:
388 if [ ! -z "$COMPILER" ]
390 echo "Error> Tried to specify two compilers: $COMPILER and $1"
395 # It specifies some other option:
398 [ $1 = "bigemulator" ] && BUILD_EMULATOR
=1
399 [ $1 = "bigsim" ] && BUILD_EMULATOR
=1
406 [ "x$VERSION" = "x" ] && syntax
&& exit 1
408 if test -n "$WITH_PRODUCTION" -a $BUILD_EMULATOR -eq 1 -a -z "$ENABLE_TRACING"
410 echo "Error: bigemulator requires tracing modules, --with-production must be used with --enable-tracing"
417 MAKE
=`which gmake 2>/dev/null`
418 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE
='make'
421 if [ ! -f $src/$BASEVERSION/conv-mach.h
]
423 if [ "x_$BASEVERSION" = "x_net-rs6k" ]
425 echo "Error> build net-aix-ppc instead of net-rs6k!"
427 echo "Error> build can not find arch: $BASEVERSION!"
432 #generate VERSION name combining all the build-time options.
433 if [ -n "$BOPTS" -o -n "$COMPILER" ]
435 echo "Selected Compiler: $COMPILER"
436 echo "Selected Options: $BOPTS"
437 SORTED
=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
438 BOPTS_WITHCOMPILER
=`echo $SORTED $COMPILER`
439 for i
in $BOPTS_WITHCOMPILER
445 #echo "|$DESTINATION|$DESTINATION_SUFFIX|"
447 if [ -z "$DESTINATION" ]
449 DESTINATION
="$VERSION"
452 if [ -n "$DESTINATION_SUFFIX" ]
454 DESTINATION
="$DESTINATION-$DESTINATION_SUFFIX"
457 [ -d $DESTINATION ] || Echo
"Creating dir: $DESTINATION"
458 [ -d $DESTINATION ] || mkdir
$DESTINATION
459 [ -d $DESTINATION/tmp
] || Echo
"Creating dir: $DESTINATION/tmp"
460 [ -d $DESTINATION/tmp
] || mkdir
$DESTINATION/tmp
462 Echo
"Copying src/scripts/Makefile to $DESTINATION/tmp"
463 rm -f $DESTINATION/tmp
/Makefile
464 rm -f $DESTINATION/tmp
/Make.depends
465 rm -f $DESTINATION/tmp
/Make.cidepends
466 rm -f $DESTINATION/tmp
/Make.lb
467 rm -f $DESTINATION/tmp
/Make.machine
468 rm -f $DESTINATION/tmp
/Make.extlib
471 # Create the bin, lib, include, etc. links:
472 WINNAME
=`echo $VERSION | awk -F- '{print $2}'`
473 if [ "x_$WINNAME" = "x_win32" -o "x_$WINNAME" = "x_win64" ]
475 #Win32/64 version needs special compilers and *copied* (not linked)
477 echo "Copying compilers for $WINNAME into cygwin /bin directory"
478 cp -f $src/$WINNAME/unix2nt
* /bin
479 cp $src/win32
/system_ln
$DESTINATION/tmp
480 cp $src/win32
/unistd.h
$DESTINATION/tmp
481 echo "Compiling createlink.cpp ..."
482 (cd $src/win32
; unix2nt_cc
-c createlink.cpp
-o createlink.o
-D_WIN32_WINNT=0x0500; unix2nt_cc createlink.o
)
483 if test ! -x $src/win32
/createlink.exe
485 echo "VC++ is not properly installed!"
488 echo "Copying $src/win32/createlink.exe to /bin directory"
489 cp $src/win32
/createlink.exe
/bin
490 chmod +x
$DESTINATION/tmp
/system_ln
491 cp $src/win32
/gathertree.
local $DESTINATION/tmp
492 cp $src/win32
/gatherflat.
local $DESTINATION/tmp
494 cat > $DESTINATION/tmp
/system_ln
<<EOF
498 chmod +x
$DESTINATION/tmp
/system_ln
499 for newdir
in `echo bin lib lib_so include tmp`
501 Echo
"Soft-linking over $newdir"
504 rm -fr $newdir ||
exit 1
506 $DESTINATION/tmp
/system_ln
$DESTINATION/$newdir $newdir
509 $DESTINATION/tmp
/system_ln
$DESTINATION/include
/VERSION VERSION
512 $DESTINATION/tmp
/system_ln
"../../src/scripts/Make.depends" $DESTINATION/tmp
/Make.depends
513 $DESTINATION/tmp
/system_ln
"../../src/scripts/Make.cidepends" $DESTINATION/tmp
/Make.cidepends
514 if test -f src
/ck-ldb
/Make.lb
516 $DESTINATION/tmp
/system_ln
"../../src/ck-ldb/Make.lb" $DESTINATION/tmp
/Make.lb
518 touch $DESTINATION/tmp
/Make.lb
520 $DESTINATION/tmp
/system_ln
"../../src/scripts/Makefile" $DESTINATION/tmp
/Makefile
521 $DESTINATION/tmp
/system_ln
"../../src/scripts/Make.tau" $DESTINATION/tmp
/Make.tau
522 touch $DESTINATION/tmp
/Makefile.machine
523 touch $DESTINATION/tmp
/Make.extlib
525 ConvUsr
="$DESTINATION/tmp/conv-mach-pre.sh"
526 Echo
"Generating $ConvUsr"
530 echo 'USER_OPTS_LD="$USER_OPTS_LD '$LIBDIR'"' >> $ConvUsr
531 echo 'USER_OPTS_LDXX="$USER_OPTS_LDXX '$LIBDIR'"' >> $ConvUsr
535 echo 'USER_OPTS_CC="$USER_OPTS_CC '$INCDIR'"' >> $ConvUsr
536 echo 'USER_OPTS_CXX="$USER_OPTS_CXX '$INCDIR'"' >> $ConvUsr
540 # Create conv-mach-opt headers with special build-time options
541 ConvHeader
="$DESTINATION/tmp/conv-mach-opt.h"
542 ConvSh
="$DESTINATION/tmp/conv-mach-opt.sh"
543 if [ ! -f $ConvSh -o ! -f $ConvHeader ]
545 Echo
"Generating $ConvHeader, conv-mach-opt.sh"
546 echo '/* Build-time options header, automatically generated by charm/build*/'> $ConvHeader
547 echo '# Built-time options header, automatically generated by charm/build'> $ConvSh
548 echo '[ -z "$CHARMINC" ] && CHARMINC="."' >> $ConvSh
550 if test -n "$COMPILER"
553 echo '#include "'cc-
$i.h
'"' >> $ConvHeader
554 echo '. $CHARMINC/'"cc-$i.sh" >> $ConvSh
560 echo '#include "'conv-mach-
$i.h
'"' >> $ConvHeader
561 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
565 if test "$BUILD_SHARED" = "-build-shared"
567 echo "CMK_NO_BUILD_SHARED=false" >> $ConvSh
569 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
572 if test -n "$WITH_ROMIO"
574 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
577 if test -n "$WITH_PRODUCTION"
579 echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
580 # Prepend optimize so that an explicit -no-optimize still works
581 OPTS
="-optimize -production $OPTS"
582 CONFIG_OPTS
="--disable-controlpoint --disable-tracing --disable-tracing-commthread --disable-charmdebug --disable-replay --disable-error-checking --disable-stats $CONFIG_OPTS"
587 if [ "$PROGRAM" = "Tau" ]
589 Echo
"TAU>>>> makefile config option: $TAU_MAKEFILE"
590 if [ -n "$TAU_MAKEFILE" -a -f $TAU_MAKEFILE ]
592 #Setting up TAU trace library:
593 Echo
"TAU>>>> configuring with this TAU makefile: $TAU_MAKEFILE"
597 Echo
"TAU>>>> ERROR could not find Makefile: $TAU_MAKEFILE, ignored"
601 [ -z "$TAU_MAKEFILE" ] && TAU_MAKEFILE
="Make.tau"
602 SED_CHARMC
="s@TAU_MAKEFILE=\(.*\)@TAU_MAKEFILE=$TAU_MAKEFILE@"
604 sed -e $SED_CHARMC src
/scripts
/Makefile
> .Makefile.$$
&& cp .Makefile.$$ src
/scripts
/Makefile
&& rm -f .Makefile.$$
605 sed -e $SED_CHARMC src
/scripts
/charmc
> .charmc.$$
&& cp .charmc.$$ src
/scripts
/charmc
&& rm -f .charmc.$$
607 if test $WITH_TAU -eq 1
609 echo "#define CMK_WITH_TAU 1" >> $ConvHeader
610 echo "#define pthread_create tau_pthread_create" >> $ConvHeader
611 echo "#define pthread_exit tau_pthread_exit" >> $ConvHeader
613 echo "CMK_WITH_TAU=\"true\"" >> $ConvSh
617 echo $BASEVERSION > $DESTINATION/tmp
/.
vdir
618 echo $VERSION |
sed -e 's@-.*@@' > $DESTINATION/tmp
/.gdir
620 if test $BUILD_EMULATOR = 1
622 PROGRAM
="$PROGRAM bigsim"
623 # CONFIG_OPTS="--disable-charmdebug $CONFIG_OPTS"
628 Echo
"-------------------------------------------------"
629 Echo
"Charm++ NOT BUILT. Either cd into $DESTINATION/tmp and try"
630 Echo
"to resolve the problems yourself, visit"
631 Echo
" http://charm.cs.illinois.edu/"
632 Echo
"for more information. Otherwise, email the developers at charm@cs.illinois.edu"
636 echo 'BUILDOPTS="'$OPTS'"' >> $ConvSh
638 Echo
"Performing '$MAKE $MAKEOPTS basics OPTS="$OPTS" QUIET="$QUIET" CONFIG_OPTS="$CONFIG_OPTS"' in $DESTINATION/tmp"
640 echo "CONFIG_OPTS=\"$CONFIG_OPTS\"" > config_opts.sh
641 chmod +x config_opts.sh
642 echo "OPTSATBUILDTIME += $OPTS" > buildopts.mk
643 $MAKE $MAKEOPTS basics OPTS
="$OPTS $BUILD_SHARED" QUIET
="$QUIET"
645 [ $MAKEEXIT -ne 0 ] && printError
647 Echo
"Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS" QUIET="$QUIET"' in $DESTINATION/tmp"
648 $MAKE $MAKEOPTS $PROGRAM OPTS
="$OPTS $BUILD_SHARED" QUIET
="$QUIET"
650 if [ $MAKEEXIT -eq 0 ]
652 Echo
"-------------------------------------------------"
653 Echo
"$PROGRAM built successfully."
654 Echo
"Next, try out a sample program like" \
655 "$DESTINATION/tests/charm++/simplearrayhello"