Skip to content

Commit

Permalink
FIX: remove calls to custom logger in c++ code and revert "big" ci test
Browse files Browse the repository at this point in the history
The custom logger made in C++ which apply python's logging is probably
too fragile when multithreaded and/or nested calls, and usage is removed for
now in the codebase (although keep the class/function until a better solution)
  • Loading branch information
jcrivenaes committed Nov 7, 2024
1 parent a609c2e commit 7173f59
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ jobs:
uses: "./.github/actions/setup_testdata"

- name: Run just tests marked big
run: OMP_NUM_THREADS=1 XTG_BIGTEST=1 pytest -n 4 tests --disable-warnings -m bigtest --generate-plots
run: XTG_BIGTEST=1 pytest -n 4 tests --disable-warnings -m bigtest --generate-plots

codecov:
runs-on: ubuntu-latest
Expand Down
13 changes: 2 additions & 11 deletions src/lib/src/regsurf/sample_grid3d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#include <iostream>
#include <vector>
#include <xtgeo/grid3d.hpp>
#include <xtgeo/logging.hpp>
#include <xtgeo/numerics.hpp>
#include <xtgeo/regsurf.hpp>

Expand All @@ -35,6 +34,7 @@ namespace xtgeo::regsurf {
* @param zcornsv Z corners of the 3D grid
* @param actnumsv Active cells of the 3D grid
* @param klayer The layer to sample, base 0
* @param index_position 0: top, 1: base|bot, 2: center
* @return Tuple of 5 numpy arrays: I index, J index, Depth_top, Depth_base, Inactive
*/

Expand All @@ -60,9 +60,6 @@ sample_grid3d_layer(const size_t ncol,
const int index_position, // 0: top, 1: base|bot, 2: center
const int num_threads = -1)
{
Logger logger(__func__);
logger.debug("Sampling 3D grid layer to a regular surface...");

// clang-format off
#ifdef __linux__
if (num_threads > 0) omp_set_num_threads(num_threads);
Expand Down Expand Up @@ -101,9 +98,6 @@ sample_grid3d_layer(const size_t ncol,
std::fill(depth_bot_.mutable_data(0, 0),
depth_bot_.mutable_data(0, 0) + (ncol * nrow), numerics::QUIET_NAN);

// Loop over the grid
logger.debug("Looping 3D GRID cell NCOLROW and NROW is", ncolgrid3d, nrowgrid3d);

// clang-format off
#pragma omp parallel for collapse(2) schedule(static)
// clang-format on
Expand Down Expand Up @@ -150,9 +144,7 @@ sample_grid3d_layer(const size_t ncol,
grid3d::is_xy_point_in_cell(p.x, p.y, corners, 2);

if (is_inside_top && is_inside_bot && !is_inside_mid) {
logger.error(
"BUG? The point is inside both top and bottom but not "
"center of the cell, seen from above. Force set to be same.");
// not sure if this is a bug... but set is_inside_mid too
is_inside_mid = is_inside_top;
}

Expand Down Expand Up @@ -200,7 +192,6 @@ sample_grid3d_layer(const size_t ncol,
}
}

logger.debug("Sampling 3D grid layer to a regular surface... done");
return std::make_tuple(iindex, jindex, depth_top, depth_bot, inactive);
} // regsurf_sample_grid3d_layer

Expand Down
1 change: 0 additions & 1 deletion src/lib/src/regsurf/utilities.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include <cstddef>
#include <tuple>
#include <xtgeo/geometry.hpp>
#include <xtgeo/logging.hpp>
#include <xtgeo/point.hpp>
#include <xtgeo/regsurf.hpp>

Expand Down

0 comments on commit 7173f59

Please sign in to comment.