Skip to content
Merged
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
8 changes: 4 additions & 4 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ if WITH_CHECK_PROGS
SUBDIRS += t
endif

if ENABLE_ACC
SUBDIRS += tools/libfrencutils_acc
SUBDIRS += tools/fregrid_acc
SUBDIRS += t_acc
if ENABLE_GPU
SUBDIRS += tools/libfrencutils_gpu
SUBDIRS += tools/fregrid_gpu
SUBDIRS += t_gpu
endif
26 changes: 13 additions & 13 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ AM_CONDITIONAL([WITH_MPI_TESTS], [test x"$build_mpi" = x"yes" -a -z "$SKIP_MPI_T
AC_ARG_ENABLE([acc],
[AS_HELP_STRING([--enable-acc],
[Builds with OpenACC. This will result in a second executable for fregrid, fregrid_gpu.(default no)])])
AS_IF([test ${enable_acc:-no} = yes],
[enable_acc=yes],
[enable_acc=no])
AS_IF([test ${enable_gpu:-no} = yes],
[enable_gpu=yes],
[enable_gpu=no])
# check compile flags
AS_IF([test ${enable_acc} = yes],
AS_IF([test ${enable_gpu} = yes],
[GX_OPENACC_FLAGS()])
AM_CONDITIONAL([ENABLE_ACC], [test "$enable_acc" = "yes"])
AM_CONDITIONAL([ENABLE_GPU], [test "$enable_gpu" = "yes"])

AC_CHECK_FUNCS(gettid, [], [])

Expand Down Expand Up @@ -135,7 +135,7 @@ else
fi

# Check if openacc.h exists
if test "$enable_acc" = yes ; then
if test "$enable_gpu" = yes ; then
AC_CHECK_HEADERS([openacc.h], [], [AC_MSG_ERROR(["Cannot find OpenACC header file"])] )
AC_MSG_WARN(Currently only NVIDIA compilers are supported to compile with OpenACC in FRE-NCTOOLS)
fi
Expand Down Expand Up @@ -206,11 +206,11 @@ AC_CONFIG_FILES([Makefile
postprocessing/split_ncvars/Makefile
postprocessing/timavg/Makefile
tools/libfrencutils/Makefile
tools/libfrencutils_acc/Makefile
tools/libfrencutils_gpu/Makefile
tools/check_mask/Makefile
tools/cubic_utils/Makefile
tools/fregrid/Makefile
tools/fregrid_acc/Makefile
tools/fregrid_gpu/Makefile
tools/make_coupler_mosaic/Makefile
tools/make_hgrid/Makefile
tools/make_land_domain/Makefile
Expand All @@ -232,11 +232,11 @@ AC_CONFIG_FILES([Makefile
tools/simple_hydrog/rmvpr/Makefile
tools/simple_hydrog/libfmslite/Makefile
t/Makefile
t_acc/Makefile
t_acc/test_read_remap_file/Makefile
t_acc/test_get_grid_cell_struct/Makefile
t_acc/test_get_upbound_nxcells_2dx2d/Makefile
t_acc/test_get_interp_order1/Makefile
t_gpu/Makefile
t_gpu/test_read_remap_file/Makefile
t_gpu/test_get_grid_cell_struct/Makefile
t_gpu/test_get_upbound_nxcells_2dx2d/Makefile
t_gpu/test_get_interp_order1/Makefile

])

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
check_PROGRAMS = test_get_grid_cell_struct

AM_CFLAGS = $(NETCDF_CFLAGS) \
-I$(top_srcdir)/tools/fregrid_acc \
-I$(top_srcdir)/tools/fregrid_gpu \
-I$(top_srcdir)/tools/libfrencutils \
-I$(top_srcdir)/tools/libfrencutils_acc -acc
-I$(top_srcdir)/tools/libfrencutils_gpu -acc

LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \
$(top_builddir)/tools/fregrid_acc/interp_utils_acc.o \
$(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \
$(top_builddir)/tools/libfrencutils/libfrencutils.a \
$(top_builddir)/tools/libfrencutils_acc/libfrencutils_acc.a
$(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a

test_get_grid_cell_struct_SOURCES = test_get_grid_cell_struct.c

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@
* <http://www.gnu.org/licenses/>.
**********************************************************************/

// This test tests the function test_get_grid_cell_struct used in fregrid_acc.
// This test tests the function test_get_grid_cell_struct used in fregrid_gpu.
// Properties of each grid cell in a smple made-up grid with no poles are computed
// on the device. This test ensures that the data transfer between the host and device
// and computations have executed on the device as expected.

#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include "create_xgrid_utils_acc.h"
#include "interp_utils_acc.h"
#include "create_xgrid_utils_gpu.h"
#include "interp_utils_gpu.h"
#include "parameters.h"
#include "globals_acc.h"
#include "globals_gpu.h"

#define NLON 36 // 36 cells in lon direction (36+1 grid points in the lon direction for each lat point)
#define NLAT 4 // 4 cells in lat direction ( 4+1 grid points in the lat direction for each lon point)
Expand Down Expand Up @@ -79,10 +79,10 @@ int main(){
}

// copy grid to device
copy_grid_to_device_acc((NLON+1)*(NLAT+1), grid.latc, grid.lonc);
copy_grid_to_device_gpu((NLON+1)*(NLAT+1), grid.latc, grid.lonc);

// get grid_cells
get_grid_cell_struct_acc( NLON, NLAT, &grid, &grid_cells);
get_grid_cell_struct_gpu( NLON, NLAT, &grid, &grid_cells);

// get answers
get_answers(grid.lonc, grid.latc, &answers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
check_PROGRAMS = test_get_interp_order1

AM_CFLAGS = $(NETCDF_CFLAGS) \
-I$(top_srcdir)/tools/fregrid_acc \
-I$(top_srcdir)/tools/fregrid_gpu \
-I$(top_srcdir)/tools/libfrencutils \
-I$(top_srcdir)/tools/libfrencutils_acc -acc
-I$(top_srcdir)/tools/libfrencutils_gpu -acc

LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \
$(top_builddir)/tools/fregrid_acc/interp_utils_acc.o \
$(top_builddir)/tools/fregrid_acc/conserve_interp_acc.o \
$(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \
$(top_builddir)/tools/fregrid_gpu/conserve_interp_gpu.o \
$(top_builddir)/tools/libfrencutils/libfrencutils.a \
$(top_builddir)/tools/libfrencutils_acc/libfrencutils_acc.a
$(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a

test_get_interp_order1_SOURCES = test_get_interp_order1.c

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,19 @@
* <http://www.gnu.org/licenses/>.
**********************************************************************/

// This test tests the function create_xgrid_2dx2d_order2_acc for a simple
// This test tests the function create_xgrid_2dx2d_order2_gpu for a simple
// case where the input grid is identical to the output grid. The exchange
// grid is identical to the input/output grid. Only the parent indices corresponding
// to each exchange cell are checked.

#include <stdlib.h>
#include <stdio.h>
#include <openacc.h>
#include "globals_acc.h"
#include "interp_utils_acc.h"
#include "conserve_interp_acc.h"
#include "create_xgrid_utils_acc.h"
#include "create_xgrid_acc.h"
#include "globals_gpu.h"
#include "interp_utils_gpu.h"
#include "conserve_interp_gpu.h"
#include "create_xgrid_utils_gpu.h"
#include "create_xgrid_gpu.h"

void generate_input_is_same_as_output_grids(Grid_config *input_grid, Grid_config *output_grid,
Interp_per_input_tile *interp_answers);
Expand Down Expand Up @@ -152,30 +152,30 @@ int run_tests(Grid_config *input_grid, Grid_config *output_grid, Interp_per_inpu
Grid_cells_struct_config output_grid_cells;

//copy grid to device
copy_grid_to_device_acc(ngridpts_input, input_grid->latc, input_grid->lonc);
copy_grid_to_device_acc(ngridpts_output, output_grid->latc, output_grid->lonc);
copy_grid_to_device_gpu(ngridpts_input, input_grid->latc, input_grid->lonc);
copy_grid_to_device_gpu(ngridpts_output, output_grid->latc, output_grid->lonc);

//get mask to skip input cells in creating interp
get_input_grid_mask_acc(ncells_input, &input_grid_mask);
get_input_grid_mask_gpu(ncells_input, &input_grid_mask);

//get output grid cell info
get_grid_cell_struct_acc(nlon_output_cells, nlat_output_cells, output_grid, &output_grid_cells);
get_grid_cell_struct_gpu(nlon_output_cells, nlat_output_cells, output_grid, &output_grid_cells);

//get bounding index
get_bounding_indices_acc(nlon_output_cells, nlat_output_cells, nlon_input_cells, nlat_input_cells,
get_bounding_indices_gpu(nlon_output_cells, nlat_output_cells, nlon_input_cells, nlat_input_cells,
output_grid->latc, input_grid->latc, &jlat_overlap_starts, &jlat_overlap_ends);

//malloc and create arrays
create_upbound_nxcells_arrays_on_device_acc(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end);
create_upbound_nxcells_arrays_on_device_gpu(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end);

upbound_nxcells = get_upbound_nxcells_2dx2d_acc(input_grid->nxc, input_grid->nyc, output_grid->nxc, output_grid->nyc,
upbound_nxcells = get_upbound_nxcells_2dx2d_gpu(input_grid->nxc, input_grid->nyc, output_grid->nxc, output_grid->nyc,
jlat_overlap_starts, jlat_overlap_ends,
input_grid->lonc, input_grid->latc,
output_grid->lonc, output_grid->latc,
input_grid_mask, &output_grid_cells,
approx_nxcells_per_ij1, ij2_start, ij2_end);

nxcells = create_xgrid_2dx2d_order1_acc( nlon_input_cells, nlat_input_cells,
nxcells = create_xgrid_2dx2d_order1_gpu( nlon_input_cells, nlat_input_cells,
nlon_output_cells, nlat_output_cells,
jlat_overlap_starts, jlat_overlap_ends,
input_grid->lonc, input_grid->latc,
Expand All @@ -184,9 +184,9 @@ int run_tests(Grid_config *input_grid, Grid_config *output_grid, Interp_per_inpu
approx_nxcells_per_ij1, ij2_start, ij2_end,
interp);

free_grid_cell_struct_acc(ncells_output, &output_grid_cells);
free_upbound_nxcells_arrays_acc(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end);
free_input_grid_mask_acc(ncells_input, &input_grid_mask);
free_grid_cell_struct_gpu(ncells_output, &output_grid_cells);
free_upbound_nxcells_arrays_gpu(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end);
free_input_grid_mask_gpu(ncells_input, &input_grid_mask);

return 0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
check_PROGRAMS = test_get_upbound_nxcells_2dx2d

AM_CFLAGS = $(NETCDF_CFLAGS) \
-I$(top_srcdir)/tools/fregrid_acc \
-I$(top_srcdir)/tools/fregrid_gpu \
-I$(top_srcdir)/tools/libfrencutils \
-I$(top_srcdir)/tools/libfrencutils_acc -acc
-I$(top_srcdir)/tools/libfrencutils_gpu -acc

LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \
$(top_builddir)/tools/fregrid_acc/conserve_interp_acc.o \
$(top_builddir)/tools/fregrid_acc/interp_utils_acc.o \
$(top_builddir)/tools/fregrid_gpu/conserve_interp_gpu.o \
$(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \
$(top_builddir)/tools/libfrencutils/libfrencutils.a \
$(top_builddir)/tools/libfrencutils_acc/libfrencutils_acc.a
$(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a

test_get_upbound_nxcells_2dx2d_SOURCES = test_get_upbound_nxcells_2dx2d.c

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
#include <stdlib.h>
#include <stdio.h>
#include <openacc.h>
#include "globals_acc.h"
#include "conserve_interp_acc.h"
#include "interp_utils_acc.h"
#include "create_xgrid_utils_acc.h"
#include "create_xgrid_acc.h"
#include "globals_gpu.h"
#include "conserve_interp_gpu.h"
#include "interp_utils_gpu.h"
#include "create_xgrid_utils_gpu.h"
#include "create_xgrid_gpu.h"

typedef struct {
int ncells_input;
Expand Down Expand Up @@ -322,33 +322,33 @@ int run_tests(Grid_config *input_grid, Grid_config *output_grid, Grid_cells_stru
double *input_grid_mask;

//copy grid to device
copy_grid_to_device_acc(ngridpts_input, input_grid->latc, input_grid->lonc);
copy_grid_to_device_acc(ngridpts_output, output_grid->latc, output_grid->lonc);
copy_grid_to_device_gpu(ngridpts_input, input_grid->latc, input_grid->lonc);
copy_grid_to_device_gpu(ngridpts_output, output_grid->latc, output_grid->lonc);

//get mask to skip input cells in creating xgrid
get_input_grid_mask_acc(ncells_input, &input_grid_mask);
get_input_grid_mask_gpu(ncells_input, &input_grid_mask);
if( ! acc_is_present(input_grid_mask, ncells_input*sizeof(double)) ) {
printf("INPUT_GRID_MASK IS NOT ON DEVICE!"); exit(1);
}

//get output grid cell info
get_grid_cell_struct_acc(nlon_output_cells, nlat_output_cells, output_grid, output_grid_cells);
get_grid_cell_struct_gpu(nlon_output_cells, nlat_output_cells, output_grid, output_grid_cells);

//get bounding indices
get_bounding_indices_acc(nlon_output_cells, nlat_output_cells, nlon_input_cells, nlat_input_cells,
get_bounding_indices_gpu(nlon_output_cells, nlat_output_cells, nlon_input_cells, nlat_input_cells,
output_grid->latc, input_grid->latc, &jlat_overlap_starts, &jlat_overlap_ends);
if(jlat_overlap_starts != 0) printf("SMETHING IS WRONG WITH JLAT_OVERLAP_STARTS %d\n", jlat_overlap_starts);
if(jlat_overlap_ends != nlat_input_cells-1) // this is what was in the original.
printf("SOMETHING IS WRONG WITH JLAT_OVERLAP_ENDS %d %d\n", jlat_overlap_ends, nlat_input_cells-1);

//malloc and create arrays
create_upbound_nxcells_arrays_on_device_acc(ncells_input, &p_approx_nxcells_per_ij1, &p_ij2_start, &p_ij2_end);
create_upbound_nxcells_arrays_on_device_gpu(ncells_input, &p_approx_nxcells_per_ij1, &p_ij2_start, &p_ij2_end);

// check to ensure all data have been transferred/created to device
check_data_on_device(input_grid, output_grid, p_approx_nxcells_per_ij1, p_ij2_start, p_ij2_end,
output_grid_cells);

*upbound_nxcells = get_upbound_nxcells_2dx2d_acc(input_grid->nxc, input_grid->nyc, output_grid->nxc, output_grid->nyc,
*upbound_nxcells = get_upbound_nxcells_2dx2d_gpu(input_grid->nxc, input_grid->nyc, output_grid->nxc, output_grid->nyc,
jlat_overlap_starts, jlat_overlap_ends,
input_grid->lonc, input_grid->latc, output_grid->lonc, output_grid->latc,
input_grid_mask, output_grid_cells,
Expand All @@ -358,7 +358,7 @@ int run_tests(Grid_config *input_grid, Grid_config *output_grid, Grid_cells_stru
*ij2_start = p_ij2_start;
*ij2_end = p_ij2_end;

free_input_grid_mask_acc(ncells_input, &input_grid_mask);
free_input_grid_mask_gpu(ncells_input, &input_grid_mask);

return 0;

Expand All @@ -372,8 +372,8 @@ void cleanup_test(Answers *answers, Grid_config *input_grid, Grid_config *output
int ncells_output = output_grid->nxc * output_grid->nyc;
int ncells_input = input_grid->nxc * input_grid->nyc;

free_grid_cell_struct_acc(ncells_output, output_grid_cells);
free_upbound_nxcells_arrays_acc(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end);
free_grid_cell_struct_gpu(ncells_output, output_grid_cells);
free_upbound_nxcells_arrays_gpu(ncells_input, &approx_nxcells_per_ij1, &ij2_start, &ij2_end);

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ check_PROGRAMS = test_read_remap_file

AM_CFLAGS = $(NETCDF_CFLAGS) \
-I$(top_srcdir)/tools/libfrencutils \
-I$(top_srcdir)/tools/libfrencutils_acc \
-I$(top_srcdir)/tools/fregrid_acc -acc
-I$(top_srcdir)/tools/libfrencutils_gpu \
-I$(top_srcdir)/tools/fregrid_gpu -acc

LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS) \
$(top_builddir)/tools/fregrid_acc/conserve_interp_acc.o \
$(top_builddir)/tools/fregrid_acc/interp_utils_acc.o \
$(top_builddir)/tools/fregrid_gpu/conserve_interp_gpu.o \
$(top_builddir)/tools/fregrid_gpu/interp_utils_gpu.o \
$(top_builddir)/tools/libfrencutils/libfrencutils.a \
$(top_builddir)/tools/libfrencutils_acc/libfrencutils_acc.a
$(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a

test_read_remap_file_SOURCES = test_read_remap_file.c

Expand Down
Loading
Loading