Skip to content

Commit

Permalink
Merge pull request #647 from lukemartinlogan/dev
Browse files Browse the repository at this point in the history
Unit tests + ctests
  • Loading branch information
lukemartinlogan authored Dec 15, 2023
2 parents 73e3b76 + 37dfeb9 commit cf296b7
Show file tree
Hide file tree
Showing 142 changed files with 8,276 additions and 9,717 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:
# run: pushd ci/cluster && ./multi_node_ci_test.sh

# - name: Generate coverage file
# run: bash ci/coverage.sh
# run: bash ci/coverage.sh "${GITHUB_WORKSPACE}/coverage" "${GITHUB_WORKSPACE}/build"

# - name: Coveralls
# uses: coverallsapp/github-action@master
Expand Down
27 changes: 26 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ option(HERMES_ENABLE_COVERAGE "Check how well tests cover code" OFF)
option(HERMES_ENABLE_DOXYGEN "Check how well the code is documented" OFF)

option(HERMES_ENABLE_POSIX_ADAPTER "Build the Hermes POSIX adapter." ON)
option(HERMES_ENABLE_STDIO_ADAPTER "Build the Hermes stdio adapter." ON)
option(HERMES_ENABLE_STDIO_ADAPTER "Build the Hermes stdio adapter." OFF)
option(HERMES_ENABLE_MPIIO_ADAPTER "Build the Hermes MPI-IO adapter." OFF)
option(HERMES_ENABLE_VFD "Build the Hermes HDF5 Virtual File Driver" OFF)
option(HERMES_ENABLE_PUBSUB_ADAPTER "Build the Hermes pub/sub adapter." OFF)
option(HERMES_ENABLE_KVSTORE "Build the Hermes KVStore adapter." OFF)
option(HERMES_ENABLE_PYTHON "Build the Hermes Python wrapper" ON)
option(HERMES_ENABLE_ADIOS "Build the Hermes Python wrapper" ON)

option(HERMES_MPICH "Specify that this a MPICH build" OFF)
option(HERMES_OPENMPI "Specify that this a OpenMPI build" OFF)
Expand Down Expand Up @@ -46,6 +47,30 @@ if(NOT HERMES_EXPORTED_TARGETS)
set(HERMES_EXPORTED_TARGETS "hrun-targets")
endif()

#-----------------------------------------------------------------------------
# Coverage
#-----------------------------------------------------------------------------
if(HERMES_ENABLE_COVERAGE)
set(COVERAGE_FLAGS "-fprofile-arcs -ftest-coverage --coverage" CACHE STRING
"Flags to the coverage program to perform coverage inspection"
)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${COVERAGE_FLAGS}")

mark_as_advanced(COVERAGE_FLAGS)

macro(set_coverage_flags target)
target_link_libraries(${target} gcov)
# set_target_properties(${target}
# PROPERTIES
# COMPILE_FLAGS ${COVERAGE_FLAGS}
# LINK_FLAGS ${COVERAGE_FLAGS}
# )
endmacro()
endif()
add_custom_target(coverage COMMAND bash ${CMAKE_SOURCE_DIR}/ci/coverage.sh
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR})

#-----------------------------------------------------------------------------
# Find Packages
#-----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,5 @@ install(TARGETS
#-----------------------------------------------------------------------------
if(HERMES_ENABLE_COVERAGE)
set_coverage_flags(test_performance_exec)
set_coverage_flags(test_hermes_api)
set_coverage_flags(hermes_api_bench)
endif()
10 changes: 5 additions & 5 deletions benchmark/test_latency.cc
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ TEST_CASE("TestHshmQueueEmplacePop") {
hrun::QueueId qid(0, 3);
u32 ops = (1 << 20);
std::vector<PriorityInfo> queue_info = {
{16, 16, ops, 0}
{TaskPrio::kAdmin, 16, 16, ops, 0}
};
auto queue = hipc::make_uptr<hrun::MultiQueue>(
qid, queue_info);
Expand All @@ -119,7 +119,7 @@ TEST_CASE("TestHshmQueueEmplacePop") {
TEST_CASE("TestHshmQueueGetLane") {
hrun::QueueId qid(0, 3);
std::vector<PriorityInfo> queue_info = {
{16, 16, 256, 0}
{TaskPrio::kAdmin, 16, 16, 256, 0}
};
auto queue = hipc::make_uptr<hrun::MultiQueue>(
qid, queue_info);
Expand All @@ -141,7 +141,7 @@ TEST_CASE("TestHshmQueueAllocateEmplacePop") {
TRANSPARENT_HERMES();
hrun::QueueId qid(0, 3);
std::vector<PriorityInfo> queue_info = {
{16, 16, 256, 0}
{TaskPrio::kAdmin, 16, 16, 256, 0}
};
auto queue = hipc::make_uptr<hrun::MultiQueue>(
qid, queue_info);
Expand Down Expand Up @@ -209,7 +209,7 @@ void TestWorkerIterationLatency(u32 num_queues, u32 num_lanes) {
for (u32 i = 0; i < num_queues; ++i) {
hrun::QueueId qid(0, i + 1);
std::vector<PriorityInfo> queue_info = {
{num_lanes, num_lanes, 256, 0}
{TaskPrio::kAdmin, num_lanes, num_lanes, 256, 0}
};
auto queue = hipc::make_uptr<hrun::MultiQueue>(
qid, queue_info);
Expand All @@ -233,7 +233,7 @@ void TestWorkerIterationLatency(u32 num_queues, u32 num_lanes) {
task = client.AsyncMdPushEmplace(queues[num_queues - 1].get(),
task_node,
hrun::DomainId::GetLocal());
worker.Run();
worker.Run(false);
HRUN_CLIENT->DelTask(task);
}
t.Pause();
Expand Down
6 changes: 4 additions & 2 deletions ci/coverage.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#!/bin/bash
COVERAGE_DIR="${GITHUB_WORKSPACE}/coverage"
COVERAGE_DIR="$1"
BUILD_DIR="$2"
mkdir -p "${COVERAGE_DIR}"
cd "${GITHUB_WORKSPACE}/build"
cd "${BUILD_DIR}"
echo $BUILD_DIR
lcov -c -d . -o "${COVERAGE_DIR}/tmp.info"
lcov --remove "${COVERAGE_DIR}/tmp.info" \
"/usr/*" \
Expand Down
2 changes: 1 addition & 1 deletion ci/hermes/packages/hermes/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class Hermes(CMakePackage):
version("0.4.0-beta", sha256="06020836e203b2f680bea24007dc73760dfb977eb61e442b795b264f0267c16b")
version("0.3.0-beta...v0.4.0-beta", sha256="7729b115598277adcab019dee24e5276698fb595066bca758bfa59dc8d51c5a4")

depends_on('hermes_shm')
depends_on('hermes_shm@master')

# Common across hermes_shm and hermes
variant('mpiio', default=True, description='Enable MPI I/O adapter')
Expand Down
3 changes: 3 additions & 0 deletions ci/hermes/packages/hermes_shm/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ class HermesShm(CMakePackage):
url = "https://github.com/lukemartinlogan/hermes_shm/archive/refs/tags/v1.0.0.tar.gz"

version('master', branch='master')
version("1.1.0", sha256="080d5361cff22794b670e4544c532926ca8b6d6ec695af25596efe035bfffea5")
version("1.0.0", sha256="a79f01d531ce89985ad59a2f62b41d74c2385e48d929e2f4ad895ae34137573b")

variant('mpiio', default=True, description='Enable MPI I/O adapter')
Expand All @@ -15,6 +16,7 @@ class HermesShm(CMakePackage):
variant('only_verbs', default=False, description='Only verbs')
variant('debug', default=False, description='Build shared libraries')
variant('zmq', default=False, description='Build ZeroMQ tests')
variant('adios', default=False, description='Build Adios tests')

depends_on('[email protected]')
depends_on('[email protected]')
Expand All @@ -30,6 +32,7 @@ class HermesShm(CMakePackage):
when='+only_verbs')
depends_on('libzmq', '+zmq')
depends_on('[email protected]', when='+vfd')
depends_on('adios2', when='+adios')

def cmake_args(self):
args = []
Expand Down
9 changes: 7 additions & 2 deletions ci/install_deps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ set -o pipefail
# Change this especially when your $HOME doesn't have enough disk space.
INSTALL_DIR="${HOME}"
SPACK_DIR=${INSTALL_DIR}/spack
SPACK_VERSION=0.18.1
SPACK_VERSION=0.20.2

echo "Installing dependencies at ${INSTALL_DIR}"
mkdir -p ${INSTALL_DIR}
Expand All @@ -29,6 +29,11 @@ set +x
. ${SPACK_DIR}/share/spack/setup-env.sh
set -x

# Install jarvis-cd
git clone https://github.com/grc-iit/jarvis-cd.git
cd jarvis-cd
pip install -e . -r requirements.txt

# This will allow Spack to skip building some packages that are directly
# available from the system. For example, autoconf, cmake, m4, etc.
# Modify ci/pckages.yaml to skip building compilers or build tools via Spack.
Expand All @@ -38,4 +43,4 @@ cp ci/packages.yaml ${SPACK_DIR}/etc/spack/packages.yaml
# Install hermes_shm (needed for dependencies)
#
spack repo add ci/hermes
spack install hermes_shm
spack install hermes_shm@master+vfd+mpiio^[email protected]
2 changes: 0 additions & 2 deletions hermes_adapters/filesystem/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ include_directories(

# Create the metadata manager singleton + FS base class
add_library(hermes_fs_base SHARED
${CMAKE_CURRENT_SOURCE_DIR}/filesystem.cc
${CMAKE_CURRENT_SOURCE_DIR}/filesystem_mdm.cc
${CMAKE_CURRENT_SOURCE_DIR}/filesystem_mdm_singleton.cc)
add_dependencies(hermes_fs_base
hermes)
Expand Down
Loading

0 comments on commit cf296b7

Please sign in to comment.