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'
28 ( cd $src ; ls -1 |
egrep -v '(^CVS)|(^shmem$)|(^mpi$)|(^sim$)|(^net$)|(^elan$)|(^util$)|(^common$)|(^uth$)|(^conv-mach-fix.sh$)|(^win32$)|(^win64$)|(^paragon$)|(^vmi$)|(^lapi$)|(^cell$)|(^template$)' |
pr -3 -t )
30 echo '<options>: compiler and platform specific options'
31 echo 'cc cc64 cxx kcc pgcc acc icc ecc gcc3 gcc4 mpcc pathscale'
32 echo 'help smp gm tcp vmi scyld clustermatic bigemulator ooc syncft papi'
34 echo '--incdir --libdir --basedir --no-build-shared -j'
38 echo 'For platform specific options, use help option:'
39 echo ' help platform specific help, e.g. ./build charm++ net-linux help'
41 echo 'Choose a compiler (only one option is allowed from this section):'
42 echo ' cc, cc64 For Sun WorkShop C++ 32/64 bit compilers'
43 echo ' cxx DIGITAL C++ compiler (DEC Alpha)'
44 echo ' kcc KAI C++ compiler'
45 echo " pgcc Portland Group's C++ compiler"
46 echo ' acc HP aCC compiler'
47 echo ' icc Intel C/C++ compiler for Linux IA32'
48 echo ' ecc Intel C/C++ compiler for Linux IA64'
49 echo ' gcc3 use gcc3 - GNU GCC/G++ version 3'
50 echo ' gcc4 use gcc4 - GNU GCC/G++ version 4 (only mpi-crayxt3)'
51 echo ' mpcc SUN Solaris C++ compiler for MPI'
52 echo ' pathscale use pathscale compiler suite'
54 echo 'Choose a fortran compile (only one option is allowed from this section):'
55 echo ' g95 G95 at http://ww.g95.org'
56 echo ' absoft Absoft fortran compiler'
57 echo " pgf90 Portland Group\'s Fortran compiler"
58 echo ' ifc Intel Fortran compiler (older versions)'
59 echo ' ifort Intel Fortran compiler (newer versions)'
61 echo 'Platform specific options (choose multiple if apply):'
62 echo ' lam Use LAM MPI'
63 echo ' smp support for SMP, multithreaded charm on each node'
64 echo ' mpt use SGI Message Passing Toolkit (only for mpi version)'
65 echo ' gm use Myrinet for communication'
66 echo ' tcp use TCP sockets for communication (ony for net version)'
67 echo " vmi use NCSA's VMI for communication (only for mpi version)"
68 echo ' scyld compile for Scyld Beowulf cluster based on bproc'
69 echo ' clustermatic compile for Clustermatic (support version 3 and 4) '
70 echo ' pthreads compile with pthreads Converse threads'
72 echo 'Advanced options:'
73 echo ' bigemulator compile for BigSim simulator'
74 echo ' ooc compile with out of core support'
75 echo ' syncft compile with Charm++ fault tolerance support'
76 echo ' papi compile with PAPI performance counter support (if any)'
78 echo "Charm++ dynamic libraries:"
79 echo " --build-shared build Charm++ dynamic libraries (.so) (default)"
80 echo " --no-build-shared don't build Charm++'s shared libraries"
82 echo 'Miscellaneous options:'
83 echo ' --incdir=DIR specify additional include path for compiler'
84 echo ' --libdir=DIR specify additional lib path for compiler'
85 echo ' --basedir=DIR shortcut for the above two - DIR/include and DIR/lib'
86 echo ' -j[N] parallel make, N is the number of paralle make jobs'
87 echo " --with-romio build AMPI with ROMIO library"
90 echo '<charmc-options>: normal compiler options e.g. -g -O -save -verbose'
95 echo "1. display all supported options for net-linux using 'help':"
96 echo ' ./build charm++ net-linux help'
97 echo '2. compile Charm++ on Linux with optimizations:'
98 echo ' ./build charm++ net-linux -O -DCMK_OPTIMIZE'
99 echo '3. compile Charm++ for Linux clustermatic Beowulf cluster with Intel compiler:'
100 echo ' ./build charm++ net-linux clustermatic icc -O'
101 echo '4. compile Charm++ for IA64 Linux cluster with MPICH-GM:'
102 echo ' ./build charm++ mpi-linux-ia64 gm -O'
103 echo '5. compile Charm++ for Windows with VC++ (Cygwin required):'
104 echo ' ./build charm++ net-win32 -O'
105 echo '6. compile on IBM SP with MPI using parallel gmake, 4 jobs simultaneously:'
106 echo ' MAKE=gmake ./build charm++ mpi-sp -j4 -O # sh'
107 echo ' setenv MAKE gmake; ./build charm++ mpi-sp -j4 -O # csh'
108 echo '7. compile Charm++ with MPI that is installed at /usr/local/mpich:'
109 echo ' ./build charm++ mpi-linux --incdir /usr/local/mpich/include --libdir /usr/local/mpich/lib -O'
111 echo ' ./build charm++ mpi-linux --basedir /usr/local/mpich -O'
113 echo 'Note: This script:'
114 echo ' 1. Creates directories <version> and <version>/tmp';
115 echo ' 2. Copies src/scripts/Makefile into <version>/tmp';
116 echo ' 3. Does a "make <target> <version> OPTS=<charmc-options>" in <version>/tmp.'
117 echo "That's all build does. The rest is handled by the Makefile."
119 echo 'You should register your copy of Charm++ with us by sending email'
120 echo 'to tms@charm.cs.uiuc.edu containing the message "subscribe charm-users"'
121 echo 'This will allow us to notify you of new releases of Charm++.'
123 echo 'Thank you for using Charm++, please send questions or comments to '
124 echo 'Parallel Programming Lab at University of Illinois at Urbana-Champaign'
125 echo '(email: ppl@cs.uiuc.edu).'
129 echo "To get more detailed help, run ./build --help"
134 for prefix
in cc conv-mach
136 str
="Supported compilers:"
137 [ "$prefix" = "conv-mach" ] && str
="Supported options:"
141 # echo "Checking for $prefix in $dir"
142 files
=`cd $dir; ls $prefix-*.h 2>/dev/null`
143 opts
="$opts "`echo $files | sed 's/'$prefix'-\([^.]*\).h/\1/g'`
146 rm -f $tmp; touch $tmp
151 opts
=`sort $tmp | uniq`
163 echo Error
: cannot
find $d!
172 [ -f $dir/cc-
$1.sh
] && return 1
180 [ -f $dir/conv-mach-
$1.h
] && return 1
183 echo "Error> option: $1 is not supported in this version!";
203 [ "$1" = '--help' -o "$1" = '-h' ] && more=1 && syntax |
more && exit 1
204 [ $# -lt 2 ] && syntax
&& exit 1
207 VERSION
=$1; BASEVERSION
=$1; ARCH
=`echo $1 | sed -e 's@-.*@@'`
214 OPT_DIRS
="$src/$BASEVERSION $src/$ARCH $src/common"
223 CheckDir
$dir/include
$dir/lib
224 LIBDIR
="$LIBDIR -L$dir/lib";
225 INCDIR
="$INCDIR -I$dir/include"
230 basedir
=`echo $1 | awk -F= '{print $2}'`
233 CheckDir
$dir/include
$dir/lib
234 LIBDIR
="$LIBDIR -L$dir/lib";
235 INCDIR
="$INCDIR -I$dir/include"
243 LIBDIR
="$LIBDIR -L$dir";
248 libdir
=`echo $1 | awk -F= '{print $2}'`
252 LIBDIR
="$LIBDIR -L$dir";
260 INCDIR
="$INCDIR -I$dir";
265 incdir
=`echo $1 | awk -F= '{print $2}'`
269 INCDIR
="$INCDIR -I$dir";
273 --no-build-shared|
-nobs|
--no-shared)
274 BUILD_SHARED
="-nobs"; shift
277 WITH_ROMIO
="true"; shift
280 # obsolete, do nothing
284 PMAKENUM
=`echo $1 | awk -Fj '{print $2}'`
285 MAKEOPTS
="$MAKEOPTS -j $PMAKENUM"
289 # We hit a real compiler option (like -g, or -Dfoo),
290 # so just copy over all remaining options
293 OPTS
="$OPTS $1"; shift
300 # This has to be a build-time option (like "smp", "gcc3", or "kcc")
304 # It specifies a compiler:
305 if [ ! -z "$COMPILER" ]
307 echo "Error> Tried to specify two compilers: $COMPILER and $1"
312 # It specifies some other option:
315 [ $1 = "bigemulator" ] && BUILD_EMULATOR
=1
322 [ "x$VERSION" = "x" ] && syntax
&& exit 1
327 MAKE
=`which gmake 2>/dev/null`
328 [ -z "$MAKE" -o ! -x "$MAKE" ] && MAKE
='make'
331 if [ ! -f $src/$BASEVERSION/conv-mach.h
]
333 echo "Error> build can not find arch: $BASEVERSION!"
337 #generate VERSION name combining all the build-time options.
338 if [ -n "$BOPTS" -o -n "$COMPILER" ]
340 echo "Selected Compiler: $COMPILER"
341 echo "Selected Options: $BOPTS"
342 SORTED
=`echo $BOPTS | awk '{ for (i = 1; i <= NF; ++i) print $i }' | sort`
343 BOPTS_WITHCOMPILER
=`echo $SORTED $COMPILER`
344 for i
in $BOPTS_WITHCOMPILER
350 [ -d $VERSION ] ||
echo "Creating dir: $VERSION"
351 [ -d $VERSION ] || mkdir
$VERSION
352 [ -d $VERSION/tmp
] ||
echo "Creating dir: $VERSION/tmp"
353 [ -d $VERSION/tmp
] || mkdir
$VERSION/tmp
355 echo "Copying src/scripts/Makefile to $VERSION/tmp"
356 rm -f $VERSION/tmp
/Makefile
357 rm -f $VERSION/tmp
/Make.depends
358 rm -f $VERSION/tmp
/Make.lb
359 rm -f $VERSION/tmp
/Make.machine
362 # Create the bin, lib, include, etc. links:
363 if [ "x_`echo $VERSION | awk -F- '{print $2}'`" = "x_win32" ]
365 #Win32 version needs special compilers and *copied* (not linked)
367 echo "Copying compilers for win32 into cygwin /bin directory"
368 cp $src/win32
/unix2nt
* /bin
369 cp $src/win32
/system_ln
$VERSION/tmp
370 cp $src/win32
/unistd.h
$VERSION/tmp
371 cp $src/win32
/createlink.exe
/bin
372 chmod +x
$VERSION/tmp
/system_ln
373 elif [ "x_`echo $VERSION | awk -F- '{print $2}'`" = "x_win64" ]
375 #Win64 version needs special compilers and *copied* (not linked)
377 echo "Copying compilers for win64 into cygwin /bin directory"
378 cp $src/win64
/unix2nt
* /bin
379 cp $src/win64
/system_ln
$VERSION/tmp
380 cp $src/win64
/unistd.h
$VERSION/tmp
381 cp $src/win64
/unistd.h
$VERSION/include
382 cp $src/win64
/createlink.exe
/bin
383 chmod +x
$VERSION/tmp
/system_ln
385 cat > $VERSION/tmp
/system_ln
<<EOF
389 chmod +x
$VERSION/tmp
/system_ln
390 for newdir
in `echo bin lib lib_so include tmp`
392 echo "Soft-linking over $newdir"
395 rm -fr $newdir ||
exit 1
397 $VERSION/tmp
/system_ln
$VERSION/$newdir $newdir
400 $VERSION/tmp
/system_ln
$VERSION/include
/VERSION VERSION
403 $VERSION/tmp
/system_ln
"../../src/scripts/Make.depends" $VERSION/tmp
/Make.depends
404 $VERSION/tmp
/system_ln
"../../src/ck-ldb/Make.lb" $VERSION/tmp
/Make.lb
405 $VERSION/tmp
/system_ln
"../../src/scripts/Makefile" $VERSION/tmp
/Makefile
406 touch $VERSION/tmp
/Makefile.machine
408 ConvUsr
="$VERSION/tmp/conv-mach-pre.sh"
409 echo "Generating $ConvUsr"
413 echo 'USER_OPTS_LD="$USER_OPTS_LD '$LIBDIR'"' >> $ConvUsr
414 echo 'USER_OPTS_LDXX="$USER_OPTS_LDXX '$LIBDIR'"' >> $ConvUsr
418 echo 'USER_OPTS_CC="$USER_OPTS_CC '$INCDIR'"' >> $ConvUsr
419 echo 'USER_OPTS_CXX="$USER_OPTS_CXX '$INCDIR'"' >> $ConvUsr
423 # Create conv-mach-opt headers with special build-time options
424 ConvHeader
="$VERSION/tmp/conv-mach-opt.h"
425 ConvSh
="$VERSION/tmp/conv-mach-opt.sh"
426 if [ ! -f $ConvSh -o ! -f $ConvHeader ]
428 echo "Generating $ConvHeader, conv-mach-opt.sh"
429 echo '/* Build-time options header, automatically generated by charm/build*/'> $ConvHeader
430 echo '# Built-time options header, automatically generated by charm/build'> $ConvSh
431 echo '[ -z "$CHARMINC" ] && CHARMINC="."' >> $ConvSh
433 if test -n "$COMPILER"
436 echo '#include "'cc-
$i.h
'"' >> $ConvHeader
437 echo '. $CHARMINC/'"cc-$i.sh" >> $ConvSh
443 echo '#include "'conv-mach-
$i.h
'"' >> $ConvHeader
444 echo '. $CHARMINC/'"conv-mach-$i.sh" >> $ConvSh
448 if test -n "$BUILD_SHARED"
450 echo "CMK_NO_BUILD_SHARED=true" >> $ConvSh
453 if test -n "$WITH_ROMIO"
455 echo "CMK_AMPI_WITH_ROMIO=\"true\"" >> $ConvSh
458 echo $BASEVERSION > $VERSION/tmp
/.
vdir
460 if test $BUILD_EMULATOR = 1
462 PROGRAM
="$PROGRAM bigsim"
465 echo "Performing '$MAKE $MAKEOPTS $PROGRAM OPTS="$OPTS"' in $VERSION/tmp"
467 $MAKE $MAKEOPTS $PROGRAM OPTS
="$OPTS $BUILD_SHARED"
470 if [ $MAKEEXIT -eq 0 ]
472 echo "-------------------------------------------------"
473 echo "$PROGRAM built successfully."
474 echo "Next, try out a sample program like" \
475 "tests/charm++/simplearrayhello"
477 echo "-------------------------------------------------"
478 echo "Charm++ NOT BUILT. Either cd into $VERSION/tmp and try"
479 echo "to resolve the problems yourself, visit"
480 echo " http://charm.cs.uiuc.edu/"
481 echo "for more information. Otherwise, email the developers at ppl@cs.uiuc.edu"