Skip to content
This repository was archived by the owner on Jul 31, 2024. It is now read-only.

Allocator traits #213

Merged
merged 9 commits into from
Jul 7, 2021
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
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.1.rc12
3.2.1.rc14
6 changes: 5 additions & 1 deletion cmake/Modules/ClangFormat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,18 @@ if(CLANG_FORMATTER)
COMMAND ${CLANG_FORMATTER} -i ${examples})
endif()

set(_MSG "'${CLANG_FORMATTER}'")
if(BLACK_FORMATTER)
set(_COMMAND ${_COMMAND}
COMMAND ${BLACK_FORMATTER} -q ${PROJECT_SOURCE_DIR})
set(_MSG "${_MSG} and '${BLACK_FORMATTER}'")
endif()

add_custom_target(${FORMAT_NAME}
${_COMMAND}
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
COMMENT "[${PROJECT_NAME}] Running '${CLANG_FORMATTER}'..."
COMMENT "[${PROJECT_NAME}] Running ${_MSG}..."
SOURCES ${headers} ${sources} ${examples})

unset(_MSG)
endif()
12 changes: 10 additions & 2 deletions cmake/Modules/Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,16 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(_BUILD_OPT ON)
endif()

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND
(TIMEMORY_BUILD_TESTING OR TIMEMORY_BUILD_MINIMAL_TESTING OR TIMEMORY_CI))
if(TIMEMORY_BUILD_TESTING)
set(TIMEMORY_BUILD_EXAMPLES ON)
endif()

if(TIMEMORY_BUILD_MINIMAL_TESTING)
set(TIMEMORY_BUILD_TESTING ON)
set(TIMEMORY_BUILD_EXAMPLES OFF)
endif()

if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" AND TIMEMORY_CI)
set(_USE_COVERAGE ON)
endif()

Expand Down
6 changes: 1 addition & 5 deletions cmake/Modules/ProjectSetup.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,8 @@ endif()
# override any cache settings
if(TIMEMORY_BUILD_TESTING)
set(TIMEMORY_BUILD_GOOGLE_TEST ON)
if(NOT TIMEMORY_BUILD_MINIMAL_TESTING)
set(TIMEMORY_BUILD_EXAMPLES ON)
endif()
else()
set(TIMEMORY_BUILD_EXAMPLES ON)
if(TIMEMORY_BUILD_MINIMAL_TESTING)
set(TIMEMORY_BUILD_GOOGLE_TEST ON)
set(TIMEMORY_BUILD_EXAMPLES OFF)
endif()
endif()
Expand Down
4 changes: 3 additions & 1 deletion pyctest-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,9 @@ def add_timem_test(name, cmd):
},
)

if len(args.tools) > 0:
if len(args.tools) > 0 and not (
len(args.tools) == 1 and args.tools[0] == "avail"
):
pyct.test(
"timemory-python-timem",
[
Expand Down
12 changes: 10 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("-h", "--help", help="Print help", action="store_true")

# support CMAKE_ARGS environment variables because
# --install-option for pip is a pain to use
env_cmake_args = os.environ.get("CMAKE_ARGS", None)
if env_cmake_args is not None:
for _arg in env_cmake_args.split(" "):
if "CMAKE_INSTALL_PREFIX" not in _arg:
cmake_args += [_arg]

gotcha_opt = False
if platform.system() == "Linux":
gotcha_opt = True
Expand Down Expand Up @@ -293,9 +301,9 @@ def _add_cmake_bool_option(_args):
cmake_args += ["-DCMAKE_OSX_DEPLOYMENT_TARGET={}".format(version)]

# DO THIS LAST!
# support PYKOKKOS_BASE_SETUP_ARGS environment variables because
# support TIMEMORY_SETUP_ARGS environment variables because
# --install-option for pip is a pain to use
# TIMEMORY_SETUP_ARGS should be space-delimited set of cmake arguments, e.g.:
# Env variables should be space-delimited set of cmake arguments, e.g.:
# export TIMEMORY_SETUP_ARGS="-DTIMEMORY_USE_MPI=ON -DTIMEMORY_USE_OMPT=OFF"
env_cmake_args = os.environ.get("TIMEMORY_SETUP_ARGS", None)
if env_cmake_args is not None:
Expand Down
3 changes: 3 additions & 0 deletions source/tests/cache_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,9 @@ class cache_tests : public ::testing::Test
trait::runtime_enabled<gpu_roofline_flops>::set(false);
trait::runtime_enabled<gpu_roofline_sp_flops>::set(false);
trait::runtime_enabled<gpu_roofline_dp_flops>::set(false);
trait::runtime_enabled<cuda_event>::set(false);
trait::runtime_enabled<cupti_activity>::set(false);
trait::runtime_enabled<cupti_counters>::set(false);
trait::runtime_enabled<cupti_pcsampling>::set(false);
}

Expand Down
4 changes: 2 additions & 2 deletions source/tests/component_bundle_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@ TEST_F(component_bundle_tests, get)

EXPECT_NEAR(std::get<0>(cb), 2.0, 0.1);
EXPECT_NEAR(std::get<0>(ab), 2.0, 0.1);
EXPECT_NEAR(std::get<1>(cb) + std::get<2>(cb), 1.0, 0.1);
EXPECT_NEAR(std::get<1>(ab), 1.0, 0.1);
EXPECT_NEAR(std::get<1>(cb) + std::get<2>(cb), 1.0, 0.15);
EXPECT_NEAR(std::get<1>(ab), 1.0, 0.15);
}

//--------------------------------------------------------------------------------------//
Expand Down
16 changes: 8 additions & 8 deletions source/tests/hybrid_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static const auto memory_unit = std::pair<int64_t, string_t>(tim::units::KiB,

// acceptable absolute error
static const double util_tolerance = 5.0;
static const double timer_tolerance = 0.075;
static const double timer_tolerance = 0.1;

// acceptable relative error
// static const double util_epsilon = 0.5;
Expand Down Expand Up @@ -100,7 +100,7 @@ get_test_name()
}

// this function consumes approximately "n" milliseconds of real time
inline void
TIMEMORY_FLATTEN void
do_sleep(long n)
{
std::this_thread::sleep_for(std::chrono::milliseconds(n));
Expand All @@ -114,7 +114,7 @@ fibonacci(long n)
}

// this function consumes approximately "t" milliseconds of cpu time
inline void
TIMEMORY_FLATTEN void
consume(long n)
{
// a mutex held by one lock
Expand Down Expand Up @@ -252,8 +252,8 @@ TEST_F(hybrid_tests, hybrid)
ASSERT_TRUE(t_util != nullptr) << obj;

EXPECT_NEAR(2.0, t_rc->get(), timer_tolerance) << obj;
EXPECT_NEAR(2.5, t_cpu->get(), timer_tolerance) << obj;
EXPECT_NEAR(125.0, t_util->get(), util_tolerance) << obj;
EXPECT_NEAR(2.5, t_cpu->get(), 2.0 * timer_tolerance) << obj;
EXPECT_NEAR(125.0, t_util->get(), 2.0 * util_tolerance) << obj;

auto* l_rc = obj.get<wall_clock*>();
auto* l_cpu = obj.get<cpu_clock*>();
Expand Down Expand Up @@ -301,8 +301,8 @@ TEST_F(hybrid_tests, auto_timer)
details::print_info(_util, 125.0, "%", cpu_util_convert);

ASSERT_NEAR(1.0, _rc.get(), timer_tolerance);
ASSERT_NEAR(1.25, _cpu.get(), timer_tolerance);
ASSERT_NEAR(125.0, _util.get(), util_tolerance);
ASSERT_NEAR(1.25, _cpu.get(), 2.0 * timer_tolerance);
ASSERT_NEAR(125.0, _util.get(), 2.0 * util_tolerance);

cpu_clock _cpu_obj = *obj.get<cpu_clock>();
double _cpu_val = obj.get<cpu_clock>()->get();
Expand Down Expand Up @@ -335,7 +335,7 @@ TEST_F(hybrid_tests, compose)

details::print_info(_cpu_obj, 0.75, "sec");

ASSERT_NEAR(0.75, _cpu_val, timer_tolerance);
ASSERT_NEAR(0.75, _cpu_val, 2.0 * timer_tolerance);
ASSERT_NEAR(_cpu_obj.get(), _cpu_val, compose_tolerance);
ASSERT_NEAR(_cpu_val, std::get<0>(_cpu_ret) + std::get<1>(_cpu_ret),
compose_tolerance);
Expand Down
Loading