Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/extra/env/gfortran_mac
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
echo Loading basic gfortran environment

# this defaults to ia64, but we will use gfortran, not ifort
export GFDL_MKMF_TEMPLATE=gfort
export F90=mpifort
export CC=mpicc
export CDEFS=" -DMACOS "
export NETCDF_LIBS=`nf-config --flibs`

8 changes: 4 additions & 4 deletions src/extra/python/isca/templates/compile.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ template_debug={{ template_dir }}/mkmf.template.debug
execdir={{ execdir }} # where code is compiled and executable is created
executable={{ executable_name }}

netcdf_flags=`nf-config --fflags --flibs`
#netcdf_flags=`nf-config --fflags --flibs`

ulimit -s unlimited # Set stack size to unlimited
#ulimit -s unlimited # Set stack size to unlimited
export MALLOC_CHECK_=0

# 3. compile the mppncombine tool if it hasn't yet been done.
Expand Down Expand Up @@ -53,13 +53,13 @@ if [ $debug == True ]; then
echo "Compiling in debug mode"

# execute mkmf to create makefile
cppDefs="-Duse_libMPI -Duse_netCDF -Duse_LARGEFILE -DINTERNAL_FILE_NML -DOVERLOAD_C8 {{compile_flags}}"
cppDefs="-Duse_libMPI -Duse_netCDF -Duse_LARGEFILE -DINTERNAL_FILE_NML -DOVERLOAD_C8 ${CDEFS} {{compile_flags}}"
$mkmf -a $sourcedir -t $template_debug -p $executable -c "$cppDefs" $pathnames $sourcedir/shared/include $sourcedir/shared/mpp/include

else

# execute mkmf to create makefile
cppDefs="-Duse_libMPI -Duse_netCDF -Duse_LARGEFILE -DINTERNAL_FILE_NML -DOVERLOAD_C8 {{compile_flags}}"
cppDefs="-Duse_libMPI -Duse_netCDF -Duse_LARGEFILE -DINTERNAL_FILE_NML -DOVERLOAD_C8 ${CDEFS} {{compile_flags}}"
$mkmf -a $sourcedir -t $template -p $executable -c "$cppDefs" $pathnames $sourcedir/shared/include $sourcedir/shared/mpp/include

fi
Expand Down
5 changes: 2 additions & 3 deletions src/extra/python/isca/templates/mkmf.template.gfort
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# typical use with mkmf
# mkmf -t template.ifc -c"-Duse_libMPI -Duse_netCDF" path_names /usr/local/include
CPPFLAGS = -I/usr/local/include
NETCDF_LIBS = `nf-config --fflags --flibs`

# FFLAGS:
# -cpp: Use the fortran preprocessor
Expand All @@ -18,8 +17,8 @@ NETCDF_LIBS = `nf-config --fflags --flibs`

FFLAGS = $(CPPFLAGS) $(NETCDF_LIBS) -cpp -fcray-pointer \
-O2 -ffree-line-length-none -fno-range-check \
-fdefault-real-8 -fdefault-double-8

-fallow-argument-mismatch -fallow-invalid-boz \
-fdefault-real-8 -fdefault-double-8
FC = $(F90)
LD = $(F90) $(NETCDF_LIBS)

Expand Down
2 changes: 1 addition & 1 deletion src/extra/python/isca/templates/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ rundir={{ rundir }} # change this if you're rerunning from the output directory

source {{ env_source }}

ulimit -s unlimited
#ulimit -s unlimited

debug={{ run_idb }} # logical to identify if running in debug mode or not

Expand Down
16 changes: 12 additions & 4 deletions src/shared/mosaic/create_xgrid.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,14 @@ void get_grid_great_circle_area_(const int *nlon, const int *nlat, const double
}
#endif

int isHeadNode_b(struct Node *list, struct Node nodeIn)
{
if(sameNode(*list, nodeIn))
return 1;
else
return 0;
}

void get_grid_great_circle_area(const int *nlon, const int *nlat, const double *x, const double *y, const double *z, double *area)
{
int nx, ny, nxp, i, j, n_in;
Expand Down Expand Up @@ -1360,7 +1368,7 @@ int clip_2dx2d_great_circle(const double x1_in[], const double y1_in[], const do
error_handler("firstIntersect is not in the subjList");
}
addNode(polyList, firstIntersect);
if( isHeadNode(intersectList, firstIntersect) ) {
if( isHeadNode_b(intersectList, firstIntersect) ) {
temp = intersectList;
intersectList = getNextNode(intersectList);
free(temp);
Expand Down Expand Up @@ -1431,7 +1439,7 @@ int clip_2dx2d_great_circle(const double x1_in[], const double y1_in[], const do
else {
addNode(polyList, *temp2);
if(temp2IsIntersect) { /* remove temp2 from intersectList */
if( isHeadNode(intersectList, *temp2) ) {
if( isHeadNode_b(intersectList, *temp2) ) {
temp = intersectList;
intersectList = getNextNode(intersectList);
free(temp);
Expand All @@ -1457,7 +1465,7 @@ int clip_2dx2d_great_circle(const double x1_in[], const double y1_in[], const do

/* add curIntersect to polyList and remove it from intersectList and curList */
addNode(polyList, curIntersect);
if( isHeadNode(intersectList, curIntersect) ) {
if( isHeadNode_b(intersectList, curIntersect) ) {
temp = intersectList;
intersectList = getNextNode(intersectList);
free(temp);
Expand All @@ -1466,7 +1474,7 @@ int clip_2dx2d_great_circle(const double x1_in[], const double y1_in[], const do
removeNode(intersectList, curIntersect);
nintersect--;

if( isHeadNode(curList, curIntersect) ) {
if( isHeadNode_b(curList, curIntersect) ) {
temp = curList;
curList = getNextNode(curList);
if( curListNum == 0 )
Expand Down
12 changes: 10 additions & 2 deletions src/shared/mpp/affinity.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@

#define _GNU_SOURCE

#ifdef MACOS

int get_cpu_affinity(void) { return -1; };
void set_cpu_affinity( int cpu ) {};

#else

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Expand Down Expand Up @@ -64,8 +71,6 @@ int get_cpu_affinity(void)
return (last_cpu == -1) ? first_cpu : -1;
}

int get_cpu_affinity_(void) { return get_cpu_affinity(); } /* Fortran interface */


/*
* Set CPU affinity to one core.
Expand All @@ -81,4 +86,7 @@ void set_cpu_affinity( int cpu )
}
}

#endif

int get_cpu_affinity_(void) { return get_cpu_affinity(); } /* Fortran interface */
void set_cpu_affinity_(int *cpu) { set_cpu_affinity(*cpu); } /* Fortran interface */