Commit 63de94a9 authored by Burlen Loring's avatar Burlen Loring

Merge branch 'cleanup' into 'master'

Cleanup

See merge request !115
parents fef72041 4956c764
......@@ -60,7 +60,7 @@ endif()
include(thread)
include(mpi)
include(vtk)
include(svtk)
include(timer)
include(pugixml)
include(timer)
......
......@@ -13,11 +13,11 @@ if (ENABLE_CATALYST)
"containing `ParaViewConfig.cmake`.")
endif()
add_library(vtk INTERFACE)
target_link_libraries(vtk INTERFACE ${VTK_LIBRARIES})
target_include_directories(vtk SYSTEM INTERFACE ${PARAVIEW_INCLUDE_DIRS})
target_compile_definitions(vtk INTERFACE ${VTK_DEFINITIONS})
add_library(svtk INTERFACE)
target_link_libraries(svtk INTERFACE ${VTK_LIBRARIES})
target_include_directories(svtk SYSTEM INTERFACE ${PARAVIEW_INCLUDE_DIRS})
target_compile_definitions(svtk INTERFACE ${VTK_DEFINITIONS})
install(TARGETS vtk EXPORT vtk)
install(EXPORT vtk DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
install(TARGETS svtk EXPORT svtk)
install(EXPORT svtk DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
......@@ -29,7 +29,7 @@ if (ENABLE_PYTHON)
add_library(python INTERFACE)
target_include_directories(python INTERFACE ${PYTHON_INCLUDE_PATH} ${MPI4PY_INCLUDE_DIR})
target_link_libraries(python INTERFACE ${PYTHON_LIBRARIES} vtk)
target_link_libraries(python INTERFACE ${PYTHON_LIBRARIES} svtk)
install(TARGETS python EXPORT python)
install(EXPORT python DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
......
......@@ -26,7 +26,7 @@ if (ENABLE_VTK_ACCELERATORS)
endif()
if (NOT ENABLE_CATALYST)
add_library(vtk INTERFACE)
add_library(svtk INTERFACE)
find_package(VTK QUIET COMPONENTS ${SENSEI_VTK_COMPONENTS})
if (NOT VTK_FOUND)
......@@ -35,10 +35,10 @@ if (NOT ENABLE_CATALYST)
"VTK_DIR to point to a directory containing `VTKConfig.cmake`.")
endif()
target_link_libraries(vtk INTERFACE ${VTK_LIBRARIES})
target_include_directories(vtk SYSTEM INTERFACE ${VTK_INCLUDE_DIRS})
target_compile_definitions(vtk INTERFACE ${VTK_DEFINITIONS})
target_link_libraries(svtk INTERFACE ${VTK_LIBRARIES})
target_include_directories(svtk SYSTEM INTERFACE ${VTK_INCLUDE_DIRS})
target_compile_definitions(svtk INTERFACE ${VTK_DEFINITIONS})
install(TARGETS vtk EXPORT vtk)
install(EXPORT vtk DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
install(TARGETS svtk EXPORT svtk)
install(EXPORT svtk DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES)
endif()
......@@ -8,7 +8,7 @@ if (ENABLE_SENSEI)
ProgrammableDataAdaptor.cxx VTKHistogram.cxx VTKDataAdaptor.cxx
VTKUtils.cxx)
set(senseiCore_libs mpi pugixml vtk thread timer diy grid)
set(senseiCore_libs mpi pugixml svtk thread timer diy grid)
if (ENABLE_CONDUIT)
list(APPEND senseiCore_sources ConduitDataAdaptor.cxx)
......
if (BUILD_TESTING)
add_executable(CompareImages CompareImages.cxx)
target_link_libraries(CompareImages vtk)
target_link_libraries(CompareImages svtk)
endif()
......@@ -4,7 +4,7 @@ target_include_directories(timer SYSTEM INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<INSTALL_INTERFACE:include/timer>)
target_link_libraries(timer vtk mpi)
target_link_libraries(timer svtk mpi)
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/"
DESTINATION include/timer FILES_MATCHING PATTERN "*.h")
......
# Timing and Profiling
The timer library record the times of user defined events and sample memory
ata user specified interval. The resulting data is written in paralel to
a CSV file in rank order. Times are stored in one file and memory use samples
in another. Each memory use sample includes the time it was taken, so that
memory use can be mapped back to corresponding events.
## Runtime controls
One can use the Timer API defined in `Timer.h` or the following environment variables
which are accessed during `timer::Initialize`
| Variable | Description |
|------------------|---------------------------------------------------|
| TIMER_ENABLE | integer turns on or off logging |
| TIMER_LOG_FILE | path to write timer log to |
| MEMPROF_LOG_FILE | path to write memory profiler log to |
| MEMPROF_INTERVAL | float number of seconds between memory recordings |
## Usage
```C++
#include <Timer.h>
void myfunc()
{
// a scoped timer, times its life span
timer::MarkEvent("myfunc");
...
}
int main(int ac, char** av)
{
MPI_Init(&ac, &av);
timer::Initialize();
...
// explicit timed event
timer::MarStartEvent("event_1");
...
timer::MarkEndEvent("event_1");
...
myfunc();
...
// another explicit timed event
timer::MarStartEvent("event_2");
...
timer::MarkEndEvent("event_2");
...
timer::Finalize();
MPI_Finalize();
return 0;
}
```
......@@ -26,11 +26,19 @@ void MPIErrorHandler(MPI_Comm *comm, int *code, ...)
int rank = 0;
MPI_Comm_rank(*comm, &rank);
int estrLen = 0;
char estr[MPI_MAX_ERROR_STRING] = {'\0'};
MPI_Error_string(*code, estr, &estrLen);
std::ostringstream oss;
oss << "rank " << rank << " encountered MPI error " << *code << std::endl
<< "=========================================================" << std::endl
<< vtksys::SystemInformation::GetProgramStack(1,0)
<< "=========================================================" << std::endl;
oss
<< "+--------------------------------------------------------+" << std::endl
<< "MPI rank " << rank << " encountered error " << *code << std::endl
<< std::endl
<< estr << std::endl
<< std::endl
<< vtksys::SystemInformation::GetProgramStack(3,0)
<< "+--------------------------------------------------------+" << std::endl;
std::cerr << oss.str() << std::endl;
......@@ -314,6 +322,11 @@ void SetCommunicator(MPI_Comm comm)
if (impl::Comm != MPI_COMM_NULL)
MPI_Comm_free(&impl::Comm);
// install an error handler
MPI_Errhandler meh;
MPI_Comm_create_errhandler(MPIErrorHandler, &meh);
MPI_Comm_set_errhandler(comm, meh);
MPI_Comm_dup(comm, &impl::Comm);
}
......@@ -346,7 +359,7 @@ void Initialize()
{
// always use isolated comm space
if (impl::Comm == MPI_COMM_NULL)
MPI_Comm_dup(MPI_COMM_WORLD, &impl::Comm);
timer::SetCommunicator(MPI_COMM_WORLD);
impl::MemProf.SetCommunicator(impl::Comm);
......@@ -389,13 +402,9 @@ void Initialize()
impl::MemProf.Initialize();
}
// enable diagnostic info about crashes and MPI errors
// enable diagnostic info about crashes
vtksys::SystemInformation::SetStackTraceOnError(1);
MPI_Errhandler meh;
MPI_Comm_create_errhandler(MPIErrorHandler, &meh);
MPI_Comm_set_errhandler(impl::Comm, meh);
// report what options are in use
int rank = 0;
MPI_Comm_rank(impl::Comm, &rank);
......
Markdown is supported
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