charmc: Generic flags to request OpenMP support from the backend compiler
authorPhil Miller <mille121@illinois.edu>
Tue, 10 Sep 2013 23:09:49 +0000 (16:09 -0700)
committerPhil Miller <mille121@illinois.edu>
Tue, 10 Sep 2013 23:09:49 +0000 (16:09 -0700)
src/arch/common/cc-icc.sh
src/arch/common/cc-xlc.sh
src/scripts/charmc
src/scripts/conv-config.sh

index 9c805f73a1e9524a083a17d2c37559a35feabd74..7f5ddfcb9a08d7531558ff522ccf1aa5cd1cf60e 100644 (file)
@@ -88,3 +88,5 @@ else      # version other than 10
 . $CHARMINC/cc-icc8.sh
 
 fi
+
+CMK_C_OPENMP="-openmp"
index 69fa8cea2274c0fc089302110ab5e851976035d9..ae86f24734cd40903a0f140fe0e7139e9c5d6461 100644 (file)
@@ -23,3 +23,5 @@ then
 fi
 CMK_AR="ar $AR_OPTS cq"
 CMK_NM="nm $AR_OPTS"
+
+CMK_C_OPENMP="-qsmp=omp"
index cb450548c89d5626289c831d50b5a6c43e7bfad3..36d32f582dd1063fcca79b552001913879eb7d7f 100755 (executable)
@@ -80,6 +80,7 @@ USE_FASTEST_CC=""
 PROG_EXT=""
 GENDEPENDS="no"
 COUNTTOKENS="no"
+USE_OPENMP="no"
 
 COPY_CHARMRUN=true
 USE_BUILD_OPTIONS=0
@@ -796,6 +797,12 @@ do
        -custom-part)
                CUSTOM_PARTITION="yes"
                ;;
+
+       -fopenmp|-openmp)
+               echo Saw OpenMP flag
+               USE_OPENMP="yes"
+               ;;
+
        -*|+*)
 #              Warning "passing unrecognized option $arg to all compilers and linkers"
                OPTS="$OPTS  $arg"
@@ -877,6 +884,19 @@ then
     fi
 fi
 
+echo "USE_OPENMP set to '$USE_OPENMP'"
+if [ "$USE_OPENMP" = "yes" ]
+then
+    echo OpenMP support enabled
+    OPTS_CC="$OPTS_CC $CMK_C_OPENMP"
+    OPTS_CXX="$OPTS_CXX $CMK_C_OPENMP"
+    OPTS_F90="$OPTS_F90 $CMK_F_OPENMP"
+    OPTS_LD="$OPTS_LD $CMK_LD_OPENMP"
+    OPTS_LDXX="$OPTS_LDXX $CMK_LD_OPENMP"
+else
+    echo OpenMP support not enabled
+fi
+
 # Look up and add the dependencies for module $1
 findModuleDep() {
        M=$1
index 961ee81bff1aa2edb89f0c52de567a4942fab11b..2804805ce82fd215373a298c8d1baa71bf13185f 100644 (file)
@@ -102,6 +102,10 @@ fi
 
 [ -z "$CMK_CELL" ] && CMK_CELL=0
 
+[ -z "$CMK_C_OPENMP" ] && CMK_C_OPENMP="-fopenmp"
+[ -z "$CMK_F_OPENMP" ] && CMK_F_OPENMP="$CMK_C_OPENMP"
+[ -z "$CMK_LD_OPENMP" ] && CMK_LD_OPENMP="$CMK_C_OPENMP"
+
 # apply incdir and libdir
 CMK_CC="$CMK_CC $CMK_INCDIR "
 CMK_CXX="$CMK_CXX $CMK_INCDIR "