Skip to content

Commit

Permalink
Rename project to 'Detector'
Browse files Browse the repository at this point in the history
  • Loading branch information
fruhland committed Jul 31, 2019
1 parent 3aa10d9 commit e812edb
Show file tree
Hide file tree
Showing 30 changed files with 244 additions and 217 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ jobs:
- stage: build
script: ./build.sh

before_deploy: tar -cf ibperf-lib-${TRAVIS_TAG}.tar -C build/ ar/libIbPerfLib.a bin/IbPerfTest bin/IbDiagPerfTest
before_deploy: tar -cf detector-${TRAVIS_TAG}.tar -C build/ ar/libdetector.a bin/perftest bin/diagtest

deploy:
provider: releases
api_key: ${ACCESS_TOKEN}
file: ibperf-lib-${TRAVIS_TAG}.tar
file: detector-${TRAVIS_TAG}.tar
skip_cleanup: true
overwrite: true
on:
repo: hhu-bsinfo/ibperf-lib
repo: hhu-bsinfo/detector
branch: master
tags: true
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -631,7 +631,7 @@ to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.

IbPerfLib
Detector
Copyright (C) 2018 Heinrich-Heine-Universitaet Duesseldorf,
Institute of Computer Science, Department Operating Systems

Expand Down
54 changes: 31 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# IbPerfLib: A small library for reading the performance counters of all InfiniBand devices in a network
# Detector: A small library for reading the performance counters of all InfiniBand devices in a network

[![Build Status](https://travis-ci.org/hhu-bsinfo/ibperf-lib.svg?branch=master)](https://travis-ci.org/hhu-bsinfo/ibperf-lib)
<p align="center">
<img src="logo.png" height=250>
</p>

<p align="center">
<a href="https://travis-ci.org/hhu-bsinfo/detector"><img src="https://travis-ci.org/hhu-bsinfo/detector.svg?branch=master"></a>
<a href="https://isocpp.org/"><img src="https://img.shields.io/badge/C%2B%2B-11-blue"></a>
<a href="https://github.com/hhu-bsinfo/observatory/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-GPLv3-orange.svg"></a>
</p>

This project uses the libibmad- and libibnetdisc-libraries to automatically discover all InfiniBand devices in a
network and read their performance counters.
It can also operate in a compatibility mode in which IbPerfLib doesn't require root privileges by using the filesystem to read the performance counters. However, it will only detect local infiniBand devices in this mode.
It can also operate in a compatibility mode in which it doesn't require root privileges by using the filesystem to read the performance counters. However, it will only detect local infiniBand devices in this mode.

It is also possible, to read the diagnostic performance counters of local infiniBand devices.

Expand All @@ -13,57 +21,57 @@ It is also possible, to read the diagnostic performance counters of local infini
This project supports Linux only. It uses the libibmad- and libibnetdisc-libraries. CMake is used to generate build
scripts. To compile everything, just run *build.sh*.
The output will be a static library, that can be linked against other projects.
To let cmake automatically download and build IbPerfLib for your project, you may insert the following code into your CMakeLists.txt:
To let cmake automatically download and build Detector for your project, you may insert the following code into your CMakeLists.txt:

```
include(ExternalProject)
ExternalProject_Add(IbPerfLib_git
GIT_REPOSITORY https://github.com/hhu-bsinfo/ibperf-lib.git
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/IbPerfLib
ExternalProject_Add(detector_git
GIT_REPOSITORY https://github.com/hhu-bsinfo/detector.git
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/detector
INSTALL_COMMAND "")
ExternalProject_Get_Property(IbPerfLib_git binary_dir)
ExternalProject_Get_Property(IbPerfLib_git source_dir)
ExternalProject_Get_Property(detector_git binary_dir)
ExternalProject_Get_Property(detector_git source_dir)
add_library(IbPerfLib STATIC IMPORTED)
set_property(TARGET IbPerfLib PROPERTY IMPORTED_LOCATION ${binary_dir}/ar/libIbPerfLib.a)
add_library(detector STATIC IMPORTED)
set_property(TARGET detector PROPERTY IMPORTED_LOCATION ${binary_dir}/ar/libdetector.a)
add_dependencies(IbPerfLib IbPerfLib_git)
add_dependencies(detector detector_git)
include_directories(${source_dir}/src)
```

All you have left to do now, is to link your project against `IbPerfLib`, `ibverbs`, `ibmad`, and `ibnetdisc` using cmake's `target_link_libraries()` instruction. You also may need to add `/usr/include/infiniband` to your include directories.
All you have left to do now, is to link your project against `Detector`, `ibverbs`, `ibmad`, and `ibnetdisc` using cmake's `target_link_libraries()` instruction. You also may need to add `/usr/include/infiniband` to your include directories.

```
target_link_libraries(IbPerfLib ibverbs ibmad ibnetdisc)
target_link_libraries(Detector ibverbs ibmad ibnetdisc)
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} -I/usr/include/infiniband)
```


# Run instructions

IbPerfLib comes with two small test programs called *IbPerfTest* and *IbDiagPerfTest*.
*IbPerfTest* scans your InfiniBand network for devices and prints their counters to `stdout`.
*IbDiagPerfTest* prints the diagnostic counters of your local infiniBand devices.
Detector comes with two small test programs called *perftest* and *diagperftest*.
*perftest* scans your InfiniBand network for devices and prints their counters to `stdout`.
*diagperftest* prints the diagnostic counters of your local infiniBand devices.

On a Debian-based system, you can run theses commands to build and run *IbPerfTest*:
On a Debian-based system, you can run theses commands to build and run *perftest*:

```
sudo apt install cmake libibmad-dev libibumad-dev libibnetdisc-dev libopensm-dev
./build.sh
sudo ./build/bin/IbPerfTest mad
sudo ./build/bin/perftest network mad
```

If you don't have root privileges, you can run IbPerfTest in compatability mode:
If you don't have root privileges, you can run perftest in compatability mode:

```
./build/bin/IbPerfTest compat
./build/bin/perftest local compat
```

To run IbDiagPerfTest, run the following command:
To run diagtest, run the following command:

```
./build/bin/IbDiagPerfTest
./build/bin/diagtest
```
52 changes: 26 additions & 26 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,56 +18,56 @@ cmake_minimum_required(VERSION 3.5)

# Set version
execute_process(COMMAND git describe --tags --abbrev=0 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE IBPERFLIB_VERSION ERROR_QUIET)
string(STRIP "${IBPERFLIB_VERSION}" IBPERFLIB_VERSION)
if (IBPERFLIB_VERSION STREQUAL "")
set(IBPERFLIB_VERSION "v0.0.0")
OUTPUT_VARIABLE DETECTOR_VERSION ERROR_QUIET)
string(STRIP "${DETECTOR_VERSION}" DETECTOR_VERSION)
if (DETECTOR_VERSION STREQUAL "")
set(DETECTOR_VERSION "v0.0.0")
endif ()

# Set git revision
execute_process(COMMAND git log -1 --format=%h --date=short HEAD WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE IBPERFLIB_GIT_REV ERROR_QUIET)
string(STRIP "${IBPERFLIB_GIT_REV}" IBPERFLIB_GIT_REV)
if (IBPERFLIB_GIT_REV STREQUAL "")
set(IBPERFLIB_GIT_REV "not available")
OUTPUT_VARIABLE DETECTOR_GIT_REV ERROR_QUIET)
string(STRIP "${DETECTOR_GIT_REV}" DETECTOR_GIT_REV)
if (DETECTOR_GIT_REV STREQUAL "")
set(DETECTOR_GIT_REV "not available")
endif ()

# Set git branch
execute_process(COMMAND git rev-parse --symbolic-full-name --abbrev-ref HEAD
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE IBPERFLIB_GIT_BRANCH ERROR_QUIET)
string(STRIP "${IBPERFLIB_GIT_BRANCH}" IBPERFLIB_GIT_BRANCH)
if (IBPERFLIB_GIT_BRANCH STREQUAL "")
set(IBPERFLIB_GIT_BRANCH "master")
OUTPUT_VARIABLE DETECTOR_GIT_BRANCH ERROR_QUIET)
string(STRIP "${DETECTOR_GIT_BRANCH}" DETECTOR_GIT_BRANCH)
if (DETECTOR_GIT_BRANCH STREQUAL "")
set(DETECTOR_GIT_BRANCH "master")
endif ()

# Set build date
string(TIMESTAMP IBPERFLIB_BUILD_DATE "%Y-%m-%d %H:%M:%S")
string(TIMESTAMP DETECTOR_BUILD_DATE "%Y-%m-%d %H:%M:%S")

# Check if the installed version of the ibmad-library supports all 64-bit error counters
execute_process(COMMAND bash -c "./check_addl_ext_counters_support.sh"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE IBPERFLIB_USE_ADDITIONAL_EXTENDED_COUNTERS)
OUTPUT_VARIABLE DETECTOR_USE_ADDITIONAL_EXTENDED_COUNTERS)

# Print build information
message("IbPerfLib ${IBPERFLIB_VERSION} - git ${IBPERFLIB_GIT_REV}(${IBPERFLIB_GIT_BRANCH}), \
build date: ${IBPERFLIB_BUILD_DATE}")
message("Detector ${DETECTOR_VERSION} - git ${DETECTOR_GIT_REV}(${DETECTOR_GIT_BRANCH}), \
build date: ${DETECTOR_BUILD_DATE}")

if (IBPERFLIB_USE_ADDITIONAL_EXTENDED_COUNTERS STREQUAL "1")
if (DETECTOR_USE_ADDITIONAL_EXTENDED_COUNTERS STREQUAL "1")
message(STATUS "Additional extended counters are supported!")
else ()
message(STATUS "Additional extended counters are not supported!")
endif ()

# Set preprocessor defines
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DIBPERFLIB_VERSION='${IBPERFLIB_VERSION}'\
-DIBPERFLIB_GIT_REV='${IBPERFLIB_GIT_REV}' -DIBPERFLIB_GIT_BRANCH='${IBPERFLIB_GIT_BRANCH}' \
-DIBPERFLIB_BUILD_DATE='${IBPERFLIB_BUILD_DATE}' \
-DUSE_ADDITIONAL_EXTENDED_COUNTERS='${IBPERFLIB_USE_ADDITIONAL_EXTENDED_COUNTERS}'")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDETECTOR_VERSION='${DETECTOR_VERSION}'\
-DDETECTOR_GIT_REV='${DETECTOR_GIT_REV}' -DDETECTOR_GIT_BRANCH='${DETECTOR_GIT_BRANCH}' \
-DDETECTOR_BUILD_DATE='${DETECTOR_BUILD_DATE}' \
-DUSE_ADDITIONAL_EXTENDED_COUNTERS='${DETECTOR_USE_ADDITIONAL_EXTENDED_COUNTERS}'")

# Set source directory variables
set(IBPERFLIB_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
set(IBPERFLIB_SRC_DIR "${IBPERFLIB_ROOT_DIR}/src")
set(DETECTOR_ROOT_DIR "${CMAKE_CURRENT_LIST_DIR}/..")
set(DETECTOR_SRC_DIR "${DETECTOR_ROOT_DIR}/src")

# Set output directory variables
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/ar)
Expand All @@ -85,6 +85,6 @@ endif ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -fPIC")

# Add subdirectories
add_subdirectory(IbPerfLib)
add_subdirectory(IbPerfTest)
add_subdirectory(IbDiagPerfTest)
add_subdirectory(detector)
add_subdirectory(perftest)
add_subdirectory(diagtest)
18 changes: 9 additions & 9 deletions cmake/IbPerfLib/CMakeLists.txt → cmake/detector/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>

project(IbPerfLib)
project(detector)
message(STATUS "Project " ${PROJECT_NAME})

include_directories(${IBPERFLIB_SRC_DIR})
include_directories(${DETECTOR_SRC_DIR})

set(SOURCE_FILES
${IBPERFLIB_SRC_DIR}/IbPerfLib/BuildConfig.cpp
${IBPERFLIB_SRC_DIR}/IbPerfLib/IbPerfCounter.cpp
${IBPERFLIB_SRC_DIR}/IbPerfLib/IbPort.cpp
${IBPERFLIB_SRC_DIR}/IbPerfLib/IbNode.cpp
${IBPERFLIB_SRC_DIR}/IbPerfLib/IbFabric.cpp
${IBPERFLIB_SRC_DIR}/IbPerfLib/IbDiagPerfCounter.cpp
${IBPERFLIB_SRC_DIR}/IbPerfLib/IbPortCompat.cpp)
${DETECTOR_SRC_DIR}/detector/BuildConfig.cpp
${DETECTOR_SRC_DIR}/detector/IbPerfCounter.cpp
${DETECTOR_SRC_DIR}/detector/IbPort.cpp
${DETECTOR_SRC_DIR}/detector/IbNode.cpp
${DETECTOR_SRC_DIR}/detector/IbFabric.cpp
${DETECTOR_SRC_DIR}/detector/IbDiagPerfCounter.cpp
${DETECTOR_SRC_DIR}/detector/IbPortCompat.cpp)

add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>

project(IbPerfTest)
project(diagtest)
message(STATUS "Project " ${PROJECT_NAME})

include_directories(${IBPERFLIB_SRC_DIR})
include_directories(${DETECTOR_SRC_DIR})

set(SOURCE_FILES
${IBPERFLIB_SRC_DIR}/IbPerfLib/test/IbPerfTest.cpp)
${DETECTOR_SRC_DIR}/detector/test/DiagTest.cpp)

add_executable(${PROJECT_NAME} ${SOURCE_FILES})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/infiniband")

target_link_libraries(${PROJECT_NAME} IbPerfLib)
target_link_libraries(${PROJECT_NAME} detector)
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,16 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>

project(IbDiagPerfTest)
project(perftest)
message(STATUS "Project " ${PROJECT_NAME})

include_directories(${IBPERFLIB_SRC_DIR})
include_directories(${DETECTOR_SRC_DIR})

set(SOURCE_FILES
${IBPERFLIB_SRC_DIR}/IbPerfLib/test/IbDiagPerfTest.cpp ../../src/IbPerfLib/BuildConfig.cpp ../../src/IbPerfLib/Exception/IbNetDiscException.h)
${DETECTOR_SRC_DIR}/detector/test/PerfTest.cpp)

add_executable(${PROJECT_NAME} ${SOURCE_FILES})

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I/usr/include/infiniband")

target_link_libraries(${PROJECT_NAME} IbPerfLib -libverbs)
target_link_libraries(${PROJECT_NAME} detector)
Binary file added logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
37 changes: 0 additions & 37 deletions src/IbPerfLib/BuildConfig.cpp

This file was deleted.

46 changes: 46 additions & 0 deletions src/detector/BuildConfig.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#include <cstdio>
#include "BuildConfig.h"

#define XSTRINGIFY(a) STRINGIFY(a)
#define STRINGIFY(a) #a

namespace Detector {

const constexpr char BuildConfig::banner[];

#ifdef DETECTOR_VERSION
const char *BuildConfig::VERSION = XSTRINGIFY(DETECTOR_VERSION);
#else
const char *BuildConfig::VERSION = "v0.0.0";
#endif

#ifdef DETECTOR_GIT_REV
const char *BuildConfig::GIT_REV = XSTRINGIFY(DETECTOR_GIT_REV);
#else
const char *BuildConfig::GIT_REV = "unknown";
#endif

#ifdef DETECTOR_GIT_BRANCH
const char *BuildConfig::GIT_BRANCH = XSTRINGIFY(DETECTOR_GIT_BRANCH);
#else
const char *BuildConfig::GIT_BRANCH = "unknown";
#endif

#ifdef DETECTOR_BUILD_DATE
const char *BuildConfig::BUILD_DATE = XSTRINGIFY(DETECTOR_BUILD_DATE);
#else
const char *BuildConfig::BUILD_DATE = "0000-00-00 00:00:00";
#endif

const bool BuildConfig::ADDITIONAL_EXTENDED_COUNTERS_ENABLED = USE_ADDITIONAL_EXTENDED_COUNTERS == 1;

void BuildConfig::printBanner() {
printf("\n");
printf(banner, VERSION, BUILD_DATE, GIT_BRANCH, GIT_REV, ADDITIONAL_EXTENDED_COUNTERS_ENABLED ? "Enabled" : "Disabled");
printf("\n\n");
}

}

#undef STRINGIFY
#undef XSTRINGIFY
Loading

0 comments on commit e812edb

Please sign in to comment.