Skip to content

Commit e7e414b

Browse files
rem1776rem1776
authored andcommitted
add new executable for make_topog_gpu
1 parent aa73645 commit e7e414b

File tree

3 files changed

+19
-4
lines changed

3 files changed

+19
-4
lines changed

tests/Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ endif
2626

2727
AM_CFLAGS = $(NETCDF_CFLAGS) -I$(top_builddir)/src -I$(top_srcdir)/tools/libfrencutils
2828
AM_FCFLAGS = -I$(top_builddir)/src
29-
LDADD = -L$(top_builddir)/src -lver $(NETCDF_LDFLAGS) $(NETCDF_LIBS)
29+
LDADD = -L$(top_builddir)/src $(NETCDF_LDFLAGS) $(NETCDF_LIBS)
3030

3131
check_PROGRAMS = \
3232
create_5degree_topog \

tools/make_topog/Makefile.am

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,24 @@ if WITH_MPI
2222
bin_PROGRAMS += make_topog_parallel
2323
endif
2424

25-
AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils $(OPENACC_CFLAGS) \
26-
$(NETCDF_CFLAGS) -I$(top_srcdir)/tools/libfrencutils_gpu
25+
if ENABLE_GPU
26+
bin_PROGRAMS += make_topog_gpu
27+
endif
28+
29+
AM_CFLAGS = -I$(top_srcdir)/tools/libfrencutils \
30+
$(NETCDF_CFLAGS)
2731
LDADD = $(NETCDF_LDFLAGS) $(NETCDF_LIBS) $(RPATH_FLAGS)
2832

2933
make_topog_SOURCES = make_topog.c \
3034
topog.c \
3135
topog.h
3236
make_topog_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils.a \
33-
$(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a \
3437
$(LDADD)
3538

3639
make_topog_parallel_SOURCES = $(make_topog_SOURCES)
3740
make_topog_parallel_CFLAGS = -Duse_libMPI $(MPI_CFLAGS) $(AM_CFLAGS)
3841
make_topog_parallel_LDADD = $(top_builddir)/tools/libfrencutils/libfrencutils_mpi.a $(LDADD) $(MPI_CLDFLAGS)
42+
43+
make_topog_gpu_SOURCES = $(make_topog_SOURCES)
44+
make_topog_gpu_CFLAGS = $(OPENACC_CFLAGS) $(AM_CFLAGS) -I$(top_srcdir)/tools/libfrencutils_gpu
45+
make_topog_gpu_LDADD = $(top_builddir)/tools/libfrencutils_gpu/libfrencutils_gpu.a $(make_topog_LDADD)

tools/make_topog/topog.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@
2424
#include "create_xgrid.h"
2525
#include "mosaic_util.h"
2626
#include "interp.h"
27+
#ifdef _OPENACC
2728
#include "interp_gpu.h"
29+
#endif
2830
#include "mpp_io.h"
2931
#include "mpp.h"
3032
#include "mpp_domain.h"
@@ -517,8 +519,14 @@ void create_realistic_topog(int nx_dst, int ny_dst, const double *x_dst, const d
517519
conserve_interp_great_circle(nx_src, ny_now, nx_dst, ny_dst, x_src, y_src,
518520
x_out, y_out, mask_src, depth_src, depth );
519521
else
522+
// use gpu accelerated routine for interpolations
523+
#ifdef _OPENACC
520524
conserve_interp_gpu(nx_src, ny_now, nx_dst, ny_dst, x_src, y_src,
521525
x_out, y_out, mask_src, depth_src, depth );
526+
#else
527+
conserve_interp(nx_src, ny_now, nx_dst, ny_dst, x_src, y_src,
528+
x_out, y_out, mask_src, depth_src, depth );
529+
#endif
522530
}
523531

524532
if (filter_topog) filter_topo(nx_dst, ny_dst, num_filter_pass, smooth_topo_allow_deepening, depth, domain);

0 commit comments

Comments
 (0)