Changing charmc with a new option for only generating moduleinit file
authorNikhil Jain <nikhil@illinois.edu>
Wed, 21 Mar 2012 18:01:14 +0000 (13:01 -0500)
committerNikhil Jain <nikhil@illinois.edu>
Wed, 21 Mar 2012 18:01:14 +0000 (13:01 -0500)
src/ck-core/init.C
src/scripts/charmc

index 68a17d3f8cb39d671609f9bfb4c5912684c50520..abb70e769bf3b35dcb361ccaf3ffce7f1cd79512 100644 (file)
@@ -1420,7 +1420,6 @@ void CharmLibInit(int peid, int numpes, int argc, char **argv){
 
   CharmLibInterOperate = 1;
   ConverseInit(argc, argv, (CmiStartFn)_initCharm, 1, 0);
-  printf("node[%d]: called CharmLibInit with %d nodes\n", CmiMyPe(), CmiNumNodes());
 }
 
 void CharmLibExit() {
index a2edbe1a6e096fbf41c3ce7c4583964e459232f5..5d5f126c93435a7f9b8ef7168e34f0a873f0565a 100755 (executable)
@@ -96,6 +96,7 @@ CMK_CELL=0
 SPU_USE_CPP=0
 SPU_EXTRA_LIBS=""
 
+BUILDONLYINIT=""
 ####################################################################
 #
 #  Utility routines used below
@@ -730,6 +731,10 @@ do
        "-pg"|"-g"|-W*|-O*)
                OPTS="$OPTS $arg"
                ;;
+               
+       "-onlymoduleinit")
+               BUILDONLYINIT="YES"
+               ;;
 
        "-fmoddir")
                F90_MODDIR="$F90_MODDIR $1"
@@ -1154,6 +1159,102 @@ Success() {
        End 0
 }
 
+buildmoduleinit() {
+modInitName="$1"
+#modInitName="moduleinit$$"
+modInitSrc="$modInitName.C"
+modInitObj="$modInitName.o"
+DoNoErrCheck $RM $modInitSrc $modInitObj > /dev/null 2>&1
+
+for module in $MODULES; do
+    echo "extern void _register$module(void);" >> $modInitSrc
+done
+for trace in $TRACEMODE; do
+    if test $trace = "summary" 
+    then
+      echo "  extern void _registerTraceSummary();" >> $modInitSrc
+    elif test $trace = "projections"
+    then
+      echo "  extern void _registerTraceProjections();" >> $modInitSrc
+    elif test $trace = "simple"
+    then
+      echo "  extern void _registerTraceSimple();" >> $modInitSrc
+    elif test $trace = "Tau"
+    then
+      echo "  extern void _registerTraceTau();" >> $modInitSrc
+    elif test $trace = "utilization" 
+    then 
+      echo "  extern void _registerTraceUtilization();" >> $modInitSrc 
+    elif test $trace = "controlPoints"
+    then
+      echo "  extern void _registerTraceControlPoints();" >> $modInitSrc
+    elif test $trace = "all"
+    then
+      echo "  extern void _registerTraceProjections();" >> $modInitSrc
+      echo "  extern void _registerTraceSummary();" >> $modInitSrc
+    fi
+done
+if test -n "$BALANCER"
+then
+    echo "extern void LBDefaultCreate(const char *);" >> $modInitSrc
+fi
+echo "void _registerExternalModules(char **argv) {" >> $modInitSrc
+for module in $MODULES; do
+    [ -n "$VERBOSE" ] && echo "Adding registration for module $module"
+    echo "  _register$module();" >> $modInitSrc
+done
+for trace in $TRACEMODE; do
+    if test $trace = "summary"
+    then
+      echo "  _registerTraceSummary();" >> $modInitSrc
+    elif test $trace = "projections"
+    then
+      echo "  _registerTraceProjections();" >> $modInitSrc
+    elif test $trace = "Tau"
+    then
+      TRACE_WITH_TAU=1
+      echo "  _registerTraceTau();" >> $modInitSrc
+    elif test $trace = "simple"
+    then
+      echo "  _registerTraceSimple();" >> $modInitSrc
+    elif test $trace = "utilization" 
+    then 
+      echo "  _registerTraceUtilization();" >>  $modInitSrc 
+    elif test $trace = "controlPoints"
+    then
+      echo "  _registerTraceControlPoints();" >> $modInitSrc
+    elif test $trace = "all"
+    then
+      echo "  _registerTraceProjections();" >> $modInitSrc
+      echo "  _registerTraceSummary();" >> $modInitSrc
+    fi
+done
+if test -n "$BALANCER"
+then
+    [ -n "$VERBOSE" ] && echo "Adding load balancer for $BALANCER"
+    for deflb in $BALANCER
+    do
+      echo "  LBDefaultCreate(\"$deflb\");" >> $modInitSrc
+    done
+fi
+echo "}" >> $modInitSrc
+
+# creating projections
+echo "void _createTraces(char **argv) {" >> $modInitSrc
+for trace in $TRACEMODE; do
+    [ -n "$VERBOSE" ] && echo "Adding registration for trace $trace"
+    echo "extern void _createTrace$trace(char **argv);" >> $modInitSrc
+    echo "_createTrace$trace(argv);" >> $modInitSrc
+done
+echo "}" >> $modInitSrc
+}
+
+if [ "$BUILDONLYINIT" = "YES" ]
+then
+       buildmoduleinit moduleinit
+       Do $CMK_CXX $OPTS_CPP_INTERNAL $OPTS_CPP $OPTS_CXX -c $modInitSrc -o $modInitObj
+       exit
+fi
 
 ##############################################################################
 #
@@ -1630,93 +1731,7 @@ then
 fi
 
 ################# Build the module initialization function ##################
-modInitName="moduleinit$$"
-modInitSrc="$modInitName.C"
-modInitObj="$modInitName.o"
-DoNoErrCheck $RM $modInitSrc $modInitObj > /dev/null 2>&1
-
-for module in $MODULES; do
-    echo "extern void _register$module(void);" >> $modInitSrc
-done
-for trace in $TRACEMODE; do
-    if test $trace = "summary" 
-    then
-      echo "  extern void _registerTraceSummary();" >> $modInitSrc
-    elif test $trace = "projections"
-    then
-      echo "  extern void _registerTraceProjections();" >> $modInitSrc
-    elif test $trace = "simple"
-    then
-      echo "  extern void _registerTraceSimple();" >> $modInitSrc
-    elif test $trace = "Tau"
-    then
-      echo "  extern void _registerTraceTau();" >> $modInitSrc
-    elif test $trace = "utilization" 
-    then 
-      echo "  extern void _registerTraceUtilization();" >> $modInitSrc 
-    elif test $trace = "controlPoints"
-    then
-      echo "  extern void _registerTraceControlPoints();" >> $modInitSrc
-    elif test $trace = "all"
-    then
-      echo "  extern void _registerTraceProjections();" >> $modInitSrc
-      echo "  extern void _registerTraceSummary();" >> $modInitSrc
-    fi
-done
-if test -n "$BALANCER"
-then
-    echo "extern void LBDefaultCreate(const char *);" >> $modInitSrc
-fi
-echo "void _registerExternalModules(char **argv) {" >> $modInitSrc
-for module in $MODULES; do
-    [ -n "$VERBOSE" ] && echo "Adding registration for module $module"
-    echo "  _register$module();" >> $modInitSrc
-done
-for trace in $TRACEMODE; do
-    if test $trace = "summary"
-    then
-      echo "  _registerTraceSummary();" >> $modInitSrc
-    elif test $trace = "projections"
-    then
-      echo "  _registerTraceProjections();" >> $modInitSrc
-    elif test $trace = "Tau"
-    then
-      TRACE_WITH_TAU=1
-      echo "  _registerTraceTau();" >> $modInitSrc
-    elif test $trace = "simple"
-    then
-      echo "  _registerTraceSimple();" >> $modInitSrc
-    elif test $trace = "utilization" 
-    then 
-      echo "  _registerTraceUtilization();" >>  $modInitSrc 
-    elif test $trace = "controlPoints"
-    then
-      echo "  _registerTraceControlPoints();" >> $modInitSrc
-    elif test $trace = "all"
-    then
-      echo "  _registerTraceProjections();" >> $modInitSrc
-      echo "  _registerTraceSummary();" >> $modInitSrc
-    fi
-done
-if test -n "$BALANCER"
-then
-    [ -n "$VERBOSE" ] && echo "Adding load balancer for $BALANCER"
-    for deflb in $BALANCER
-    do
-      echo "  LBDefaultCreate(\"$deflb\");" >> $modInitSrc
-    done
-fi
-echo "}" >> $modInitSrc
-
-# creating projections
-echo "void _createTraces(char **argv) {" >> $modInitSrc
-for trace in $TRACEMODE; do
-    [ -n "$VERBOSE" ] && echo "Adding registration for trace $trace"
-    echo "extern void _createTrace$trace(char **argv);" >> $modInitSrc
-    echo "_createTrace$trace(argv);" >> $modInitSrc
-done
-echo "}" >> $modInitSrc
-
+buildmoduleinit "moduleinit$$"
 Do $CMK_CXX $OPTS_CPP_INTERNAL $OPTS_CPP $OPTS_CXX -c $modInitSrc -o $modInitObj
 
 ###############################################################################