Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added setting to generate a CTestNotes.cmake #89

Merged
merged 2 commits into from
Oct 20, 2020
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 1 addition & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,6 @@ script:
- cd build-timemory/Linux
- make install -j
- if [ -f "tests/test-python-install-import.cmake" ]; then cmake -P tests/test-python-install-import.cmake; fi
- echo "Testing is Done"

after_success:
- eval "${MATRIX_EVAL}"
# Create lcov report: capture coverage info, filter, debugging, and upload
- if [ -n "${COVERAGE}" ]; then echo "Capturing coverage..."; lcov --directory . --capture --output-file coverage.info ; fi
- if [ -n "${COVERAGE}" ]; then echo "Removing some coverage..."; lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*/external/*' '*/examples/*' '*/source/tests/*' '*/source/tools/*' --output-file coverage.info; fi
- if [ -n "${COVERAGE}" ]; then echo "Listing coverage..."; lcov --list coverage.info; fi
- if [ -n "${COVERAGE}" ]; then echo "Submitting coverage..."; bash <(curl -s https://codecov.io/bash) -f coverage.info || echo "Codecov did not collect coverage reports"; fi
- echo "Testing is Done"
1 change: 1 addition & 0 deletions examples/ex-cxx-tuple/ex_cxx_tuple.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ main(int argc, char** argv)
tim::settings::json_output() = true;
tim::enable_signal_detection();
tim::dmp::initialize(argc, argv);
tim::timemory_init(argc, argv);

tim::component_tuple_t<papi_tuple_t> m("PAPI measurements");
m.start();
Expand Down
2 changes: 2 additions & 0 deletions examples/ex-gpu-roofline/ex_gpu_roofline_bare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ int
main(int argc, char** argv)
{
tim::mpi::initialize(argc, argv);
tim::timemory_init(argc, argv);

tim::component::wall_clock wc;
wc.start();
Expand Down Expand Up @@ -184,6 +185,7 @@ main(int argc, char** argv)

printf("\nTotal time: %f seconds\n", wc.get());

tim::timemory_finalize();
tim::mpi::finalize();
}

Expand Down
7 changes: 4 additions & 3 deletions pyctest-runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-

"""
PyCTest driver for TiMemory
PyCTest driver for timemory
"""

import os
Expand Down Expand Up @@ -44,7 +44,7 @@ def configure():

# Get pyctest argument parser that include PyCTest arguments
parser = helpers.ArgumentParser(
project_name="TiMemory",
project_name="timemory",
source_dir=os.getcwd(),
binary_dir=os.path.join(
os.getcwd(), "build-timemory", platform.system()
Expand Down Expand Up @@ -310,9 +310,10 @@ def configure():
args.papi = False

os.environ["PYCTEST_TESTING"] = "ON"
os.environ["TIMEMORY_PLOT_OUTPUT"] = "OFF"
os.environ["TIMEMORY_BANNER"] = "OFF"
os.environ["TIMEMORY_CTEST_NOTES"] = "ON"
os.environ["TIMEMORY_ENABLE_SIGNAL_HANDLER"] = "ON"
# os.environ["TIMEMORY_PLOT_OUTPUT"] = "OFF"

# update PYTHONPATH for the unit tests
pypath = os.environ.get("PYTHONPATH", "").split(":")
Expand Down
2 changes: 1 addition & 1 deletion scripts/submit-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ cd ${DIR}
echo "Generating coverage..."
lcov --directory . --capture --output-file coverage.info
echo "Removing coverage..."
lcov --remove coverage.info '/usr/*' "${HOME}"'/.cache/*' '*/external/*' '*/examples/*' '*/tests/*' '*/tools/*' '*/python/*' --output-file coverage.info
lcov --remove coverage.info '/usr/*' '/tmp/*' "${HOME}"'/.cache/*' '*/external/*' '*/examples/*' '*/tests/*' '*/tools/*' '*/python/*' --output-file coverage.info
echo "Listing coverage..."
lcov --list coverage.info
echo "Submitting coverage..."
Expand Down
4 changes: 2 additions & 2 deletions source/python/libpytimemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ PYBIND11_MODULE(libpytimemory, tim)
//==================================================================================//
py::module opts = tim.def_submodule("options", "I/O options submodule");
//----------------------------------------------------------------------------------//
opts.attr("echo_dart") = false;
opts.attr("ctest_notes") = false;
opts.attr("echo_dart") = tim::settings::dart_output();
opts.attr("ctest_notes") = tim::settings::ctest_notes();
opts.attr("matplotlib_backend") = std::string("default");

//==================================================================================//
Expand Down
35 changes: 19 additions & 16 deletions source/tests/aligned_allocator_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,17 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include "test_macros.hpp"

TIMEMORY_TEST_ARGS
TIMEMORY_TEST_MAIN

#include "timemory/backends.hpp"
#include "timemory/config.hpp"
#include "timemory/environment/definition.hpp"
#include "timemory/ert/aligned_allocator.hpp"
#include "timemory/settings.hpp"

#include "gtest/gtest.h"

#include <chrono>
#include <iostream>
#include <limits>
Expand Down Expand Up @@ -84,6 +89,14 @@ struct is_intrinsic<__m256d> : std::true_type
namespace details
{
//--------------------------------------------------------------------------------------//
// Get the current tests name
//
inline std::string
get_test_name()
{
return ::testing::UnitTest::GetInstance()->current_test_info()->name();
}
//--------------------------------------------------------------------------------------//
// shorthand for check if type is an intrinsic type
//
template <typename Tp, bool _Val = true>
Expand Down Expand Up @@ -150,7 +163,10 @@ print(std::ostream& os, const std::string& label, const _Vec<Tp, _ImplicitArgs..
//--------------------------------------------------------------------------------------//

class aligned_allocator_tests : public ::testing::Test
{};
{
protected:
TIMEMORY_TEST_DEFAULT_SUITE_BODY
};

//--------------------------------------------------------------------------------------//

Expand Down Expand Up @@ -291,16 +307,3 @@ TEST_F(aligned_allocator_tests, m128d)
}

//--------------------------------------------------------------------------------------//

int
main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
tim::settings::dart_output() = true;
tim::settings::dart_count() = 1;
tim::settings::banner() = false;

return RUN_ALL_TESTS();
}

//--------------------------------------------------------------------------------------//
23 changes: 3 additions & 20 deletions source/tests/kokkosp_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#include "test_macros.hpp"

#include "timemory/api/kokkosp.hpp"
#include "timemory/timemory.hpp"

#include "gtest/gtest.h"

#include <chrono>
#include <condition_variable>
#include <iostream>
Expand All @@ -35,8 +35,7 @@
#include <thread>
#include <vector>

static int _argc = 0;
static char** _argv = nullptr;
TIMEMORY_TEST_DEFAULT_MAIN

using mutex_t = std::mutex;
using lock_t = std::unique_lock<mutex_t>;
Expand Down Expand Up @@ -211,19 +210,3 @@ TEST_F(kokkosp_tests, data_routines)
}

//--------------------------------------------------------------------------------------//

int
main(int argc, char** argv)
{
::testing::InitGoogleTest(&argc, argv);
_argc = argc;
_argv = argv;

auto ret = RUN_ALL_TESTS();

tim::timemory_finalize();
tim::dmp::finalize();
return ret;
}

//--------------------------------------------------------------------------------------//
4 changes: 4 additions & 0 deletions source/tests/test_macros.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ using stringstream_t = std::stringstream;
TIMEMORY_TEST_MAIN

#define TIMEMORY_TEST_SUITE_SETUP(...) \
protected: \
static void SetUpTestSuite() \
{ \
tim::settings::verbose() = 0; \
Expand All @@ -74,6 +75,7 @@ using stringstream_t = std::stringstream;
#define TIMEMORY_TEST_DEFAULT_SUITE_SETUP TIMEMORY_TEST_SUITE_SETUP({})

#define TIMEMORY_TEST_SUITE_TEARDOWN(...) \
protected: \
static void TearDownTestSuite() \
{ \
__VA_ARGS__; \
Expand All @@ -84,6 +86,7 @@ using stringstream_t = std::stringstream;
#define TIMEMORY_TEST_DEFAULT_SUITE_TEARDOWN TIMEMORY_TEST_SUITE_TEARDOWN({})

#define TIMEMORY_TEST_SETUP(...) \
protected: \
void SetUp() override \
{ \
puts(""); \
Expand All @@ -95,6 +98,7 @@ using stringstream_t = std::stringstream;
#define TIMEMORY_TEST_DEFAULT_SETUP TIMEMORY_TEST_SETUP({})

#define TIMEMORY_TEST_TEARDOWN(...) \
protected: \
void TearDown() override \
{ \
__VA_ARGS__; \
Expand Down
4 changes: 3 additions & 1 deletion source/tests/trace_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ timemory_trace_set_mpi(bool use, bool attached);
class trace_tests : public ::testing::Test
{
protected:
static void SetUpTestCase()
static void SetUpTestSuite()
{
#if defined(TIMEMORY_MPI_GOTCHA)
timemory_trace_set_mpi(true, false);
Expand Down Expand Up @@ -161,6 +161,8 @@ TEST_F(trace_tests, add_hash_ids)
tim::component::user_trace_bundle::reset();
tim::component::user_trace_bundle::configure<wall_clock>();

EXPECT_EQ(tim::component::user_trace_bundle::bundle_size(), 1);

for(auto& itr : cxx_hash_ids)
{
_hash_ids.push_back((char*) itr.c_str());
Expand Down
2 changes: 1 addition & 1 deletion source/timemory/components/cupti/cupti_activity.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ struct cupti_activity : public base<cupti_activity, intmax_t>
else if(lvl == 0)
{
// general settings for kernels, runtime, overhead
_kinds = { { CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL } };
_kinds = { CUPTI_ACTIVITY_KIND_CONCURRENT_KERNEL };
}
else if(lvl == 1)
{
Expand Down
2 changes: 1 addition & 1 deletion source/timemory/components/rusage/components.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ struct priority_context_switch : public base<priority_context_switch>
static std::string description()
{
return "Number of context switch due to higher priority process becoming runnable"
" or because the current process exceeded its time slice)";
" or because the current process exceeded its time slice";
}
static value_type record() { return get_num_priority_context_switch(); }
value_type get_display() const
Expand Down
10 changes: 2 additions & 8 deletions source/timemory/manager/declaration.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,14 +110,8 @@ class manager

void add_file_output(const string_t& _category, const string_t& _label,
const string_t& _file);
void add_text_output(const string_t& _label, const string_t& _file)
{
add_file_output("text", _label, _file);
}
void add_json_output(const string_t& _label, const string_t& _file)
{
add_file_output("json", _label, _file);
}
void add_text_output(const string_t& _label, const string_t& _file);
void add_json_output(const string_t& _label, const string_t& _file);

/// \fn set_write_metadata
/// \brief Set to 0 for yes if other output, -1 for never, or 1 for yes
Expand Down
23 changes: 23 additions & 0 deletions source/timemory/manager/definition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
# include "timemory/config.hpp"
# include "timemory/mpl/policy.hpp"
# include "timemory/mpl/type_traits.hpp"
# include "timemory/operations/types/finalize/ctest_notes.hpp"
# include "timemory/settings/declaration.hpp"
# include "timemory/utility/macros.hpp"
//
Expand Down Expand Up @@ -270,7 +271,10 @@ manager::finalize()
(int) m_pointer_fini.size());

if(m_instance_count == 0 && m_rank == 0)
{
operation::finalize::ctest_notes<manager>::get_notes().reset();
write_metadata("manager::finalize");
}

m_is_finalized = true;
}
Expand Down Expand Up @@ -474,6 +478,25 @@ manager::add_file_output(const string_t& _category, const string_t& _label,
m_output_files[_category][_label].insert(_file);
}
//
//--------------------------------------------------------------------------------------//
//
TIMEMORY_MANAGER_LINKAGE(void)
manager::add_text_output(const string_t& _label, const string_t& _file)
{
add_file_output("text", _label, _file);
auto _settings = f_settings();
if(_settings && _settings->get_ctest_notes())
operation::finalize::ctest_notes<manager>::get_notes()->insert(_file);
}
//
//--------------------------------------------------------------------------------------//
//
TIMEMORY_MANAGER_LINKAGE(void)
manager::add_json_output(const string_t& _label, const string_t& _file)
{
add_file_output("json", _label, _file);
}
//
//----------------------------------------------------------------------------------//
//
TIMEMORY_MANAGER_LINKAGE(void)
Expand Down
5 changes: 5 additions & 0 deletions source/timemory/operations/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,11 @@ struct flamegraph;
//
//--------------------------------------------------------------------------------------//
//
template <typename Type>
struct ctest_notes;
//
//--------------------------------------------------------------------------------------//
//
namespace base
{
//
Expand Down