Add a '-production' flag for architecture-specific features
authorPhil Miller <mille121@illinois.edu>
Thu, 21 Oct 2010 00:17:08 +0000 (19:17 -0500)
committerPhil Miller <mille121@illinois.edu>
Thu, 21 Oct 2010 00:21:58 +0000 (19:21 -0500)
Abhinav requested a flag to indicate that architecture-specific
production-mode features should be enabled. Add it from front (/build)
to back (charmc), with documentation.

To add something to the compiler flags, add an appropriate definition
of CMK_PRODUCTION or CMK_{C,CXX,F90,LD,LDXX}_PRODUCTION to
conv-mach.sh or cc-foo.sh, and the -production flag will include it in
the options passed to the underlying compiler.

I did *not* make a test for this in the configure script, nor define a
C preprocessor macro CMK_PRODUCTION, because code should never be
testing that directly. Architecture-specific scripts should be
enabling particular features where they're appropriate.

build
doc/install/compile.tex
src/scripts/charmc

diff --git a/build b/build
index e7172efc369afcf6468c3f8b1f002ca71e99ae44..df481e44134bdf4afb1bcd95e5b0b498647e168b 100755 (executable)
--- a/build
+++ b/build
@@ -564,7 +564,7 @@ if test -n "$WITH_PRODUCTION"
 then
     echo '#define CMK_OPTIMIZE 1' >> $ConvHeader
     # Prepend optimize so that an explicit -no-optimize still works
-    OPTS="-optimize $OPTS"
+    OPTS="-optimize -production $OPTS"
     CONFIG_OPTS="--disable-controlpoint --disable-tracing --disable-charmdebug --disable-replay --disable-error-checking $CONFIG_OPTS"
 fi
 
index 3889be14bca76a663ad9ce32fdd37be179d2caea..23233316e4999d2b0442da22a13c5c60c36ad19d 100644 (file)
@@ -83,6 +83,12 @@ Causes files to be compiled with maximum optimization.
 If this follows -O on the command line, it turns optimization back off.
 This is just a convenience for simple-minded makefiles.
 
+\item[{\tt -production}:]
+
+Enable architecture-specific production-mode features. For instance,
+use available hardware features more aggressively. It's probably a bad
+idea to build some objects with this, and others without.
+
 \item[{\tt -s}:]
 
 Strip the executable of debugging symbols.  Only meaningful when
index 143d1effb97288ae7025ca36c47da55a9a62c973..ffd015e4b0839a1f2d7bd3d0991e1ff377191f87 100755 (executable)
@@ -74,6 +74,7 @@ DELETE=""
 MAINOBJ=""   
 GENCPM=""
 OPTIMIZE_MODE=""
+PRODUCTION_MODE=""
 USE_RELIABLE_CC=""
 USE_FASTEST_CC=""
 PROG_EXT=""
@@ -709,6 +710,13 @@ do
        "-no-optimize")
                OPTIMIZE_MODE=false
                ;;
+
+       "-production")
+               PRODUCTION_MODE=true
+               ;;
+       "-no-production")
+               PRODUCTION_MODE=false
+               ;;
        
        "-pg"|"-g"|-W*|-O*)
                OPTS="$OPTS $arg"
@@ -988,6 +996,16 @@ then
     OPTS_LDXX="$CMK_CXX_OPTIMIZE $OPTS_LDXX"
 fi
 
+# Pick up per-architecture production mode settings
+if [ "$PRODUCTION_MODE" = "true" ]
+then
+    OPTS_CC="$CMK_PRODUCTION $CMK_C_PRODUCTION $OPTS_CC"
+    OPTS_CXX="$CMK_PRODUCTION $CMK_CXX_PRODUCTION $OPTS_CXX"
+    OPTS_F90="$CMK_PRODUCTION $CMK_F90_PRODUCTION $OPTS_F90"
+    OPTS_LD="$CMK_PRODUCTION $CMK_C_PRODUCTION $OPTS_LD"
+    OPTS_LDXX="$CMK_PRODUCTION $CMK_CXX_PRODUCTION $OPTS_LDXX"
+fi
+
 if [ -n "$XI_INTERNAL" ]
 then
     CMK_XIOPTS="$CMK_XIOPTS -intrinsic"