Skip to content

Commit

Permalink
fix errors and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mlee03 authored and mlee03 committed May 17, 2024
1 parent 6aaa997 commit 2cbc4e2
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion t_acc/test_get_cell_minmaxavg_latlons/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ AM_CFLAGS = $(NETCDF_CFLAGS) \
-I$(top_srcdir)/tools/libfrencutils_acc -acc

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include <stdio.h>
#include <math.h>
#include "create_xgrid_utils_acc.h"
#include "conserve_interp_utils_acc.h"
#include "interp_utils_acc.h"
#include "parameters.h"

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

copy_grid_to_device(0, grid);
get_cell_minmaxavg_latlons( NLON, NLAT, grid[0].lonc, grid[0].latc, &cell);
copy_grid_to_device_acc(0, grid);
get_cell_minmaxavg_latlons_acc( NLON, NLAT, grid[0].lonc, grid[0].latc, &cell);

get_answers(grid[0].lonc, grid[0].latc, &answers);

Expand Down
2 changes: 1 addition & 1 deletion t_acc/test_read_remap_file/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ AM_CFLAGS = $(NETCDF_CFLAGS) \

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

Expand Down
6 changes: 3 additions & 3 deletions t_acc/test_read_remap_file/test_read_remap_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <math.h>
#include <unistd.h>
#include "conserve_interp_acc.h"
#include "fregrid_utils_acc.h"
#include "interp_utils_acc.h"
#include "globals.h"

#define NTILES_IN 6
Expand Down Expand Up @@ -80,8 +80,8 @@ int main(int argc, char *argv[]) {
}

// read in remap and transfer data to device
read_remap_file(NTILES_IN, NTILES_OUT, interp, opcode) ;
copy_interp_to_device(NTILES_IN, NTILES_OUT, interp, opcode) ;
read_remap_file_acc(NTILES_IN, NTILES_OUT, interp, opcode) ;
copy_interp_to_device_acc(NTILES_IN, NTILES_OUT, interp, opcode) ;

// get all answers
for(int n=0 ; n<NTILES_OUT ; n++) {
Expand Down
6 changes: 3 additions & 3 deletions tools/fregrid_acc/conserve_interp_acc.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ void setup_conserve_interp_acc(int ntiles_in, const Grid_config *grid_in, int nt
CellStruct *cell_in;

if( opcode & READ) {
read_remap_file(ntiles_in, ntiles_out, interp, opcode);
copy_interp_to_device(ntiles_in, ntiles_out, interp, opcode);
read_remap_file_acc(ntiles_in, ntiles_out, interp, opcode);
copy_interp_to_device_acc(ntiles_in, ntiles_out, interp, opcode);
}
else {
i_in = (int *)malloc(MAXXGRID * sizeof(int ));
Expand Down Expand Up @@ -438,7 +438,7 @@ void setup_conserve_interp_acc(int ntiles_in, const Grid_config *grid_in, int nt
void read_remap_file
Reads in the weight/remap file if provided and copies the data to the device
*******************************************************************************/
void read_remap_file(int ntiles_in, int ntiles_out, Interp_config *interp, unsigned int opcode)
void read_remap_file_acc(int ntiles_in, int ntiles_out, Interp_config *interp, unsigned int opcode)
{

int *i_in=NULL, *j_in=NULL, *i_out=NULL, *j_out=NULL;
Expand Down
2 changes: 1 addition & 1 deletion tools/fregrid_acc/conserve_interp_acc.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,6 @@ void do_vector_conserve_interp_acc(Interp_config *interp, int varid, int ntiles_
const Grid_config *grid_out, const Field_config *u_in, const Field_config *v_in,
Field_config *u_out, Field_config *v_out, unsigned int opcode);

void read_remap_file(int ntiles_in, int ntiles_out, Interp_config *interp, unsigned int opcode);
void read_remap_file_acc(int ntiles_in, int ntiles_out, Interp_config *interp, unsigned int opcode);

#endif
6 changes: 3 additions & 3 deletions tools/fregrid_acc/interp_utils_acc.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
void copy_grid_to_device( const int itile, Grid_config *grid )
Copies lat lon coordinates to device
*******************************************************************************/
void copy_grid_to_device( const int itile, const Grid_config *grid )
void copy_grid_to_device_acc( const int itile, const Grid_config *grid )
{

int nxp, nyp;
Expand All @@ -43,8 +43,8 @@ void copy_grid_to_device( const int itile, const Grid_config *grid )
void copy_interp_to_device( Interp_config *interp )
Copies the interp struct to device
*******************************************************************************/
void copy_interp_to_device( const int ntiles_in, const int ntiles_out, const Interp_config *interp,
const unsigned int opcode )
void copy_interp_to_device_acc( const int ntiles_in, const int ntiles_out, const Interp_config *interp,
const unsigned int opcode )
{

#pragma acc enter data copyin(interp[:ntiles_out])
Expand Down
6 changes: 3 additions & 3 deletions tools/fregrid_acc/interp_utils_acc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@

#include "globals.h"

void copy_grid_to_device( const int itile, const Grid_config *grid );
void copy_grid_to_device_acc( const int itile, const Grid_config *grid );

void copy_interp_to_device( const int ntiles_in, const int ntiles_out, const Interp_config *interp,
const unsigned int opcode );
void copy_interp_to_device_acc( const int ntiles_in, const int ntiles_out, const Interp_config *interp,
const unsigned int opcode );

#endif

0 comments on commit 2cbc4e2

Please sign in to comment.