Commit 778ab3a4 authored by Mulas, Giacomo's avatar Mulas, Giacomo
Browse files

Merge branch 'offload_trapping' of git.ia2.inaf.it:giacomo.mulas/np_tmcode into offload_trapping

parents bfaf5e39 4a5e1a2b
Loading
Loading
Loading
Loading
+21 −12
Original line number Original line Diff line number Diff line
@@ -26,15 +26,15 @@ OFFLOADFLAGS=""
# Function declarations
# Function declarations
function guess_cxx {
function guess_cxx {
    # Guess the name of the C++ compiler
    # Guess the name of the C++ compiler
    result=$(which mpicxx)
    result=$(which mpicxx 2>/dev/null)
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which g++)
	result=$(which g++ 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which clang)
	result=$(which clang 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which icpx)
	result=$(which icpx 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result="none"
	result="none"
@@ -44,21 +44,21 @@ function guess_cxx {


function guess_fc {
function guess_fc {
    # Guess the name of the FORTRAN compiler
    # Guess the name of the FORTRAN compiler
    result=$(which mpif90)
    result=$(which mpif90 2>/dev/null)
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which gfortran)
	result=$(which gfortran 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which f77)
	result=$(which f77 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which flang)
	result=$(which flang 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which flang-new)
	result=$(which flang-new 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result=$(which ifx)
	result=$(which ifx 2>/dev/null)
    fi
    fi
    if [ "x$result" = "x" ]; then
    if [ "x$result" = "x" ]; then
	result="none"
	result="none"
@@ -626,6 +626,11 @@ if [ "x$CUBLAS" != "xno" ]; then
		cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cublas)
		cuda_pkg=$(for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cublas)
    		CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
    		CUDAFLAGS=$(pkg-config --cflags ${cuda_pkg})
    		CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
    		CUDALDFLAGS=$(pkg-config --libs ${cuda_pkg})
	    else
		# CUBLAS not detected
		CUBLAS="no"
		CUDAFLAGS=""
		CUDALDFLAGS=""
            fi # end of CUBLAS runtime decision tree
            fi # end of CUBLAS runtime decision tree
            declare -a pkg_array=$(pkg-config --list-all | grep cudart)
            declare -a pkg_array=$(pkg-config --list-all | grep cudart)
            for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
            for i in "${pkg_array[@]}"; do echo "$i" | cut --delimiter=" " -f1; done | grep cudart > /dev/null
@@ -639,13 +644,17 @@ if [ "x$CUBLAS" != "xno" ]; then
            echo $CUDALDFLAGS | grep cublas > /dev/null
            echo $CUDALDFLAGS | grep cublas > /dev/null
            cudart_check=$?
            cudart_check=$?
            if [ "x${cudart_check}" != "x0" ]; then
            if [ "x${cudart_check}" != "x0" ]; then
		if [ "x${CUBLAS}" != "xno" ]; then
		    CUDALDFLAGS="$CUDALDFLAGS -lcublas"
		    CUDALDFLAGS="$CUDALDFLAGS -lcublas"
		fi
		fi
            fi
            echo $CUDALDFLAGS | grep cudart > /dev/null
            echo $CUDALDFLAGS | grep cudart > /dev/null
            cudart_check=$?
            cudart_check=$?
            if [ "x${cudart_check}" != "x0" ]; then
            if [ "x${cudart_check}" != "x0" ]; then
		if [ "x${CUBLAS}" != "xno" ]; then
		    CUDALDFLAGS="$CUDALDFLAGS -lcudart"
		    CUDALDFLAGS="$CUDALDFLAGS -lcudart"
		fi
		fi
            fi
	else
	else
            # pkg-config is not available
            # pkg-config is not available
            if [ -f /usr/local/cuda/include/cuda.h ]; then
            if [ -f /usr/local/cuda/include/cuda.h ]; then
+5 −3
Original line number Original line Diff line number Diff line
@@ -328,6 +328,8 @@ def load_model(model_file):
                    for j in range(expected_radii):
                    for j in range(expected_radii):
                        sconf['rcf'][i][j] = float(model['particle_settings']['rad_frac'][i][j])
                        sconf['rcf'][i][j] = float(model['particle_settings']['rad_frac'][i][j])
        # Create the gconf dict
        # Create the gconf dict
        use_refinement = False
        dyn_orders = True
        try:
        try:
            use_refinement = False if model['system_settings']['refinement'] == "0" else True
            use_refinement = False if model['system_settings']['refinement'] == "0" else True
        except KeyError:
        except KeyError:
@@ -335,7 +337,7 @@ def load_model(model_file):
        try:
        try:
            dyn_orders = False if model['radiation_settings']['dyn_orders'] == "0" else True
            dyn_orders = False if model['radiation_settings']['dyn_orders'] == "0" else True
        except KeyError:
        except KeyError:
            use_refinement = False
            dyn_orders = True
        str_polar = model['radiation_settings']['polarization']
        str_polar = model['radiation_settings']['polarization']
        if (str_polar not in ["LINEAR", "CIRCULAR"]):
        if (str_polar not in ["LINEAR", "CIRCULAR"]):
            print("ERROR: %s is not a recognized polarization state."%str_polar)
            print("ERROR: %s is not a recognized polarization state."%str_polar)
@@ -875,10 +877,10 @@ def write_legacy_gconf(conf):
    output.write(str_line)
    output.write(str_line)
    str_line = " {0:d}\n0\n".format(conf['jwtm'])
    str_line = " {0:d}\n0\n".format(conf['jwtm'])
    output.write(str_line)
    output.write(str_line)
    if (gconf['use_refinement']):
    if (conf['use_refinement']):
        str_line = "USE_REFINEMENT=1\n"
        str_line = "USE_REFINEMENT=1\n"
        output.write(str_line)
        output.write(str_line)
    if (not gconf['dyn_orders']):
    if (not conf['dyn_orders']):
        str_line = "USE_DYN_ORDER=0\n"
        str_line = "USE_DYN_ORDER=0\n"
        output.write(str_line)
        output.write(str_line)
    output.close()
    output.close()