Commit 10b6ef1c authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Replace remap timer by cdo_get_wtime().

parent 0d3cdb94
......@@ -70,6 +70,13 @@ case "${HOSTNAME}" in
LDFLAGS="/opt/local/lib/gcc5/libstdc++.6.dylib -Wl,-rpath,$HOME/local/eccodes-2.6.0/lib" \
CXX=g++-mp-5 CXXFLAGS="-g -Wall -W -Wfloat-equal -pedantic -O3 -march=native" \
CC=gcc-mp-5 CFLAGS="-g -Wall -W -Wfloat-equal -pedantic -O3 -march=native"
elif test "$COMP" = gnu_pic ; then
${CONFPATH}configure --prefix=$HOME/local \
--enable-maintainer-mode \
$CDOLIBS \
LDFLAGS="/opt/local/lib/gcc6/libstdc++.6.dylib -Wl,-rpath,$HOME/local/eccodes-2.6.0/lib" \
CXX=g++ CXXFLAGS="-g -fPIC" \
CC=gcc CFLAGS="-g -fPIC"
elif test "$COMP" = gnu ; then
${CONFPATH}configure --prefix=$HOME/local \
--enable-maintainer-mode \
......
......@@ -616,7 +616,6 @@ remapSetFracMin(size_t gridsize, double *array, double missval, RemapGrid *tgt_g
}
int timer_remap, timer_remap_init, timer_remap_sort;
int timer_remap_bil, timer_remap_bic, timer_remap_dis, timer_remap_con, timer_remap_con_l1, timer_remap_con_l2;
static void
remapTimerInit(void)
......@@ -624,12 +623,6 @@ remapTimerInit(void)
timer_remap = timer_new("remap");
timer_remap_init = timer_new("remap init");
timer_remap_sort = timer_new("remap sort");
timer_remap_bil = timer_new("remap bil");
timer_remap_bic = timer_new("remap bic");
timer_remap_dis = timer_new("remap dis");
timer_remap_con = timer_new("remap con");
timer_remap_con_l1 = timer_new("remap con loop1");
timer_remap_con_l2 = timer_new("remap con loop2");
}
static void
......
#define USE_OMP_WTIME
#ifdef USE_OMP_WTIME
#ifdef _OPENMP
#include <omp.h> // omp_get_wtime
#endif
......@@ -11,3 +15,15 @@ cdo_get_wtime()
return 0;
#endif
}
#else
#include <chrono>
inline double
cdo_get_wtime()
{
return std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() / 1000.;
}
#endif
......@@ -16,10 +16,10 @@
*/
#include "cdo_int.h"
#include "cdo_wtime.h"
#include "grid.h"
#include "remap.h"
#include "remap_store_link.h"
#include "timer.h"
// bicubic interpolation
......@@ -102,8 +102,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
if (src_grid->rank != 2) cdoAbort("Can't do bicubic interpolation when source grid rank != 2");
extern int timer_remap_bic;
if (cdoTimer) timer_start(timer_remap_bic);
double start = cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
......@@ -189,7 +188,7 @@ remapBicubicWeights(RemapSearch &rsearch, RemapVars &rv)
weightLinks4ToRemapLinks(tgt_grid_size, weightLinks, rv);
if (cdoTimer) timer_stop(timer_remap_bic);
if (cdoVerbose) cdoPrint("Square search nearest: %.2f seconds", cdo_get_wtime() - start);
} // scrip_remap_weights_bicubic
/*
......@@ -210,8 +209,7 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
if (src_grid->rank != 2) cdoAbort("Can't do bicubic interpolation when source grid rank != 2");
extern int timer_remap_bic;
if (cdoTimer) timer_start(timer_remap_bic);
double start = cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
......@@ -298,5 +296,5 @@ remapBicubic(RemapSearch &rsearch, const double *restrict src_array, double *res
progressStatus(0, 1, 1);
if (cdoTimer) timer_stop(timer_remap_bic);
if (cdoVerbose) cdoPrint("Square search nearest: %.2f seconds", cdo_get_wtime() - start);
} // remapBicubic
......@@ -16,11 +16,10 @@
*/
#include "cdo_int.h"
#include "cdo_wtime.h"
#include "grid.h"
#include "remap.h"
#include "remap_store_link.h"
#include "timer.h"
#include "cdoOptions.h"
// bilinear interpolation
......@@ -165,8 +164,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
if (src_grid->rank != 2) cdoAbort("Can't do bilinear interpolation when source grid rank != 2");
extern int timer_remap_bil;
if (cdoTimer) timer_start(timer_remap_bil);
double start = cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
......@@ -252,7 +250,7 @@ remapBilinearWeights(RemapSearch &rsearch, RemapVars &rv)
weightLinksToRemapLinks(0, tgt_grid_size, weightLinks, rv);
if (cdoTimer) timer_stop(timer_remap_bil);
if (cdoVerbose) cdoPrint("Square search nearest: %.2f seconds", cdo_get_wtime() - start);
} // scrip_remap_weights_bilinear
/*
......@@ -273,8 +271,7 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
if (src_grid->rank != 2) cdoAbort("Can't do bilinear interpolation when source grid rank != 2");
extern int timer_remap_bil;
if (cdoTimer) timer_start(timer_remap_bil);
double start = cdoVerbose ? cdo_get_wtime() : 0;
progressInit();
......@@ -358,5 +355,5 @@ remapBilinear(RemapSearch &rsearch, const double *restrict src_array, double *re
progressStatus(0, 1, 1);
if (cdoTimer) timer_stop(timer_remap_bil);
if (cdoVerbose) cdoPrint("Square search nearest: %.2f seconds", cdo_get_wtime() - start);
} // remapBilinear
......@@ -16,11 +16,11 @@
*/
#include "cdo_int.h"
#include "cdo_wtime.h"
#include "grid.h"
#include "remap.h"
#include "remap_store_link.h"
#include "cdoOptions.h"
#include "timer.h"
extern "C" {
#include "lib/yac/clipping.h"
......@@ -28,12 +28,6 @@ extern "C" {
#include "lib/yac/geometry.h"
}
//#define STIMER
#ifdef STIMER
#include <time.h>
#endif
struct search_t
{
enum yac_edge_type *src_edge_type;
......@@ -685,13 +679,12 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
// Variables necessary if segment manages to hit pole
int src_remap_grid_type = src_grid->remap_grid_type;
int tgt_remap_grid_type = tgt_grid->remap_grid_type;
extern int timer_remap_con;
if (cdoVerbose) cdoPrint("Called %s()", __func__);
progressInit();
if (cdoTimer) timer_start(timer_remap_con);
double start = cdoVerbose ? cdo_get_wtime() : 0;
size_t src_grid_size = src_grid->size;
size_t tgt_grid_size = tgt_grid->size;
......@@ -770,10 +763,6 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
num_srch_cells_stat[1] = 100000;
num_srch_cells_stat[2] = 0;
#ifdef STIMER
double stimer = 0;
#endif
// Loop over destination grid
#ifdef _OPENMP
......@@ -798,10 +787,7 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
weightLinks[tgt_cell_add].nlinks = 0;
// Get search cells
#ifdef STIMER
clock_t start = clock();
#endif
// Get search cells
if (src_remap_grid_type == REMAP_GRID_TYPE_REG2D && tgt_remap_grid_type == REMAP_GRID_TYPE_REG2D)
{
......@@ -842,10 +828,6 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
num_srch_cells
= get_srch_cells(tgt_cell_add, rsearch.tgtBins, rsearch.srcBins, tgt_cell_bound_box_r, srch_add[ompthID]);
}
#ifdef STIMER
clock_t finish = clock();
stimer += ((double) (finish - start)) / CLOCKS_PER_SEC;
#endif
if (1 && cdoVerbose)
{
......@@ -970,10 +952,6 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
progressStatus(0, 1, 1);
#ifdef STIMER
printf("stime = %gs\n", stimer);
#endif
if (1 && cdoVerbose)
{
cdoPrint("Num search cells min,mean,max : %zu %3.1f %zu",
......@@ -1014,8 +992,7 @@ remapConservWeights(RemapSearch &rsearch, RemapVars &rv)
remapVarsCheckWeights(rv);
}
if (cdoTimer) timer_stop(timer_remap_con);
if (cdoVerbose) cdoPrint("Cells search: %.2f seconds", cdo_get_wtime() - start);
} // remapConservWeights
void
......
......@@ -14,21 +14,13 @@
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <limits.h>
#include <time.h>
#include <cdi.h>
#include "cdo_int.h"
#include "cdo_wtime.h"
#include "grid.h"
#include "remap.h"
#include "remap_store_link_cnsrv.h"
#include "cdoOptions.h"
#include "timer.h"
#define ZERO 0.0
#define ONE 1.0
......@@ -37,8 +29,7 @@
#define HALF 0.5
#define QUART 0.25
/* #define BABY_STEP 0.001 */ /* original value */
#define BABY_STEP 0.001
#define BABY_STEP 0.001 /* original value */
/* static double north_thresh = 1.45; */ /* threshold for coord transformation */
/* static double south_thresh = -2.00; */ /* threshold for coord transformation */
......@@ -1229,7 +1220,6 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
long i;
double findex = 0;
extern int timer_remap_con, timer_remap_con_l1, timer_remap_con_l2;
if (cdoVerbose) cdoPrint("Called %s()", __func__);
......@@ -1246,7 +1236,7 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
cdoPrint("South threshhold: %g", south_thresh);
}
if (cdoTimer) timer_start(timer_remap_con);
double start = cdoVerbose ? cdo_get_wtime() : 0;
long src_grid_size = src_grid->size;
long tgt_grid_size = tgt_grid->size;
......@@ -1291,8 +1281,6 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
srch_corners = tgt_num_cell_corners;
if (cdoTimer) timer_start(timer_remap_con_l1);
#ifdef _OPENMP
#pragma omp parallel for default(none) \
shared(findex, rsearch, num_wts, src_centroid_lon, src_centroid_lat, grid_store, rv, cdoVerbose, max_subseg, \
......@@ -1468,8 +1456,6 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
}
}
if (cdoTimer) timer_stop(timer_remap_con_l1);
/* Finished with all cells: deallocate search arrays */
for (i = 0; i < Threading::ompNumThreads; ++i)
......@@ -1493,8 +1479,6 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
srch_corners = src_num_cell_corners;
if (cdoTimer) timer_start(timer_remap_con_l2);
findex = 0;
#ifdef _OPENMP
......@@ -1675,8 +1659,6 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
progressStatus(0, 1, 1);
if (cdoTimer) timer_stop(timer_remap_con_l2);
/* Finished with all cells: deallocate search arrays */
for (i = 0; i < Threading::ompNumThreads; ++i)
......@@ -1824,6 +1806,5 @@ remapConservWeightsScrip(RemapSearch &rsearch, RemapVars &rv)
Free(tgt_centroid_lat);
Free(tgt_centroid_lon);
if (cdoTimer) timer_stop(timer_remap_con);
if (cdoVerbose) cdoPrint("Cells search: %.2f seconds", cdo_get_wtime() - start);
} // remapConservWeightsScrip
......@@ -598,7 +598,7 @@ remapSearchInit(RemapMethod mapType, RemapSearch &search, RemapGrid &src_grid, R
{
if (!(src_grid.remap_grid_type == REMAP_GRID_TYPE_REG2D || tgt_grid.remap_grid_type == REMAP_GRID_TYPE_REG2D))
{
double start = cdoVerbose ? omp_get_wtime() : 0;
double start = cdoVerbose ? cdo_get_wtime() : 0;
search.srcBins.cell_bound_box.resize(4 * src_grid.size);
if (tgt_grid.luse_cell_corners) search.tgtBins.cell_bound_box.resize(4 * tgt_grid.size);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment