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

Develop #25

Merged
merged 107 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
107 commits
Select commit Hold shift + click to select a range
005e0e3
Add googletest
jim-ec Feb 19, 2023
1d481da
Write tests for exportToXml
jim-ec Feb 21, 2023
501f11a
Write XML schema for exportToXml output
jim-ec Feb 21, 2023
1e6b3ac
Validate XMLs in tests
jim-ec Feb 21, 2023
acce662
Implement RAII type to avoid memory leaks
jim-ec Feb 21, 2023
654997c
Extend RAII
jim-ec Feb 21, 2023
978400b
Write tests for attributes
jim-ec Feb 21, 2023
7cdd120
Validate sample output
jim-ec Feb 21, 2023
83dc6cc
Separate tests into modules
jim-ec Feb 21, 2023
1aa5376
Fix test resource access
jim-ec Feb 21, 2023
4ab531c
Use unique_ptr instead of own RAII implementation
jim-ec Feb 21, 2023
f272b48
Ignore .vscode
jim-ec Feb 21, 2023
06df5e6
Fix schema
jim-ec Feb 22, 2023
e5fb8c6
Add attributes to the schema
jim-ec Feb 25, 2023
f80624d
Validate that attributes
jim-ec Mar 1, 2023
24809d5
Reduce boiler plate code by using relative XPaths
jim-ec Mar 1, 2023
7732b3d
Ignore test exports
jim-ec Mar 1, 2023
794ede6
Validate component addresses
jim-ec Mar 1, 2023
3337a10
Test topology constructors, setters and getters
jim-ec Mar 1, 2023
126940b
Test CheckComponentTreeConsistency
jim-ec Mar 1, 2023
c1b7164
Test complex component functions
jim-ec Mar 1, 2023
4801139
Add datapath tests
jim-ec Mar 7, 2023
8e8a54e
Remove GetTopologySize test
jim-ec Mar 8, 2023
92cf001
Add definitions for Storage::SetSize and GetSize
jim-ec Mar 8, 2023
18660b1
Nullify parent pointer
jim-ec Mar 8, 2023
fa6d718
Rename test suites
jim-ec Mar 8, 2023
4493e0a
Initialize count of component
jim-ec Mar 8, 2023
49f612a
Test custom attributes
jim-ec Mar 8, 2023
e65964c
Add missing virtual destructors
jim-ec Mar 8, 2023
3693189
Test hwloc
jim-ec Mar 8, 2023
69bf163
Add missing virtual destructors
jim-ec Mar 8, 2023
2711e95
Test GPU topology
jim-ec Mar 8, 2023
f769fb2
Test parseCapsNumaBenchmark
jim-ec Mar 8, 2023
0aa3120
Rename test xml file
jim-ec Mar 8, 2023
0a1a35c
Use ut instead of gtest
jim-ec Mar 8, 2023
ff5c058
Fix gcc warnings
jim-ec Mar 10, 2023
668f4d4
Use docker to run tests
jim-ec Mar 10, 2023
ad53323
Add readme for running tests
jim-ec Mar 10, 2023
3adc772
Add cpuinfo tests
jim-ec Mar 10, 2023
2ad8885
Add get-parent-by-type test
jim-ec Mar 10, 2023
a01a858
Add cmake option for sanitizers
jim-ec Mar 10, 2023
09eba4b
Add example workflow
jim-ec Mar 20, 2023
add6d67
Use GitHub runner
jim-ec Apr 4, 2023
eba96e6
Run tests in runner
jim-ec Apr 4, 2023
6919154
Fix workflow
jim-ec Apr 4, 2023
63a6e6c
ls
jim-ec Apr 4, 2023
a77b7d9
ls
jim-ec Apr 4, 2023
e5b85cb
Add git checkout
jim-ec Apr 4, 2023
ec2093b
Try to use second job
jim-ec Apr 4, 2023
6d74f84
Use artifacts
jim-ec Apr 4, 2023
bcbf5ee
Test in separate job
jim-ec Apr 4, 2023
bf4c6ed
Rename CMake options
jim-ec Apr 4, 2023
9b66042
Only run ASan if the test succeded
jim-ec Apr 4, 2023
aeb4d00
Use clang in workflow
jim-ec Apr 4, 2023
f86c522
Use clang++
jim-ec Apr 4, 2023
4d56379
Use composite action
jim-ec Apr 4, 2023
e0771ab
Checkout before running sub-action
jim-ec Apr 4, 2023
5908092
ls
jim-ec Apr 4, 2023
984eb8e
ls -aR
jim-ec Apr 4, 2023
2a87f31
Fix directory structure
jim-ec Apr 4, 2023
2d3ae32
Fix missing shell property
jim-ec Apr 4, 2023
e2e9adb
Do not use composite action
jim-ec Apr 4, 2023
3cc82cb
Descriptions
jim-ec Apr 4, 2023
cacc75b
Add ubsan job
jim-ec Apr 4, 2023
a2e6244
Initialize class field
jim-ec Apr 4, 2023
6431595
Use GCC sanitizers
jim-ec Apr 4, 2023
60dc683
Use GCC on runners
jim-ec Apr 4, 2023
6ab1e4a
Add coverage flag
jim-ec Apr 5, 2023
3541226
Remove shell property
jim-ec Apr 9, 2023
00fff75
Try to use a reusable workflow
jim-ec Apr 9, 2023
e75b9b7
Fix job dep
jim-ec Apr 9, 2023
888784a
Clean up CI
jim-ec Apr 9, 2023
625e8e2
Clean up CI
jim-ec Apr 9, 2023
877e427
Fix label
jim-ec Apr 9, 2023
59092d9
Documentation coverage
jim-ec Apr 9, 2023
63cb7d5
Add doc job
jim-ec Apr 9, 2023
d7dbc4a
Do not generate latex output
jim-ec Apr 9, 2023
4145bb7
Fix doc job
jim-ec Apr 9, 2023
45f7399
Fix typo
jim-ec Apr 9, 2023
190f6d7
Fix
jim-ec Apr 9, 2023
d18c75d
cd into docs
jim-ec Apr 9, 2023
44bb892
fix relative path
jim-ec Apr 9, 2023
b2f6b64
minor changes and new api calls
Dec 15, 2023
72bffda
Merge branch 'develop' of https://github.com/caps-tum/sys-sage into d…
Dec 15, 2023
6edc3b6
updated mt4g dependency
Dec 15, 2023
ffbb71f
Merge remote-tracking branch 'ci-jim/master' into ci
Dec 15, 2023
20379c3
make it compile
Dec 15, 2023
490f10e
get/set size
Dec 15, 2023
97c6a43
fix caps-numa-benchmark test
Dec 15, 2023
d7c6b25
documentation stubs
Dec 15, 2023
94c298b
more documentation stubs
Dec 15, 2023
aac7947
more doc stubs in datapath.hpp
Dec 15, 2023
95299d4
update code coverage test
Dec 15, 2023
d04d263
test address sanitizer
Dec 15, 2023
2e51c81
more address sanitizers
Dec 15, 2023
f753e6a
small fix
Dec 15, 2023
7ad4937
update gpu example to delete topology
Dec 16, 2023
48fe41d
disable address sanitizer test
Dec 16, 2023
611c23a
doc test
Dec 18, 2023
45efbe1
ci doc
Dec 18, 2023
dba14d4
ci doc limit scope
Dec 18, 2023
4727ed1
remove ci doc coverage -- does not work properly
Dec 18, 2023
bd19d51
Merge pull request #22 from caps-tum/ci
stepanvanecek Dec 18, 2023
212f943
fix hwloc ds -- print to buffer and to a file
Dec 18, 2023
e941925
Merge pull request #23 from caps-tum/fixing-hwloc-ds
stepanvanecek Dec 18, 2023
4fb93b6
add option for exporting hwloc to stdout
Dec 18, 2023
8b85749
Merge pull request #24 from caps-tum/fixing-hwloc-ds
stepanvanecek Dec 18, 2023
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
43 changes: 43 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
on: [push]
jobs:
test:
name: Unit Tests
uses: ./.github/workflows/test.yml
asan:
name: Address Sanitizer
needs: test
uses: ./.github/workflows/test.yml
with:
flags: -DTEST_ASAN=OFF
#TODO -DTEST_ASAN=ON
tsan:
name: Thread Sanitizer
needs: test
uses: ./.github/workflows/test.yml
with:
flags: -DTEST_TSAN=ON
ubsan:
name: Undefined Behaviour Sanitizer
needs: test
uses: ./.github/workflows/test.yml
with:
flags: -DTEST_UBSAN=ON
# TODO check documentation CI so that unnecessary files (.cpp, examples/,...) can be left out
# doc:
# name: Documentation
# runs-on: [ubuntu-latest]
# steps:
# - name: Checkout
# uses: actions/checkout@v3
# with:
# submodules: true
# - name: Install Doxygen
# run: sudo apt install doxygen
# - name: Install coverxygen
# run: pip3 install coverxygen
# - name: Generate documentation
# run: cd docs && doxygen Doxyfile
# - name: Generate documentation coverage
# run: cd docs && python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3 --scope public,protected --kind enum,enumvalue,friend,typedef,function,class,struct,union,define,file,namespace --prefix */src/
# - name: Documentation report
# run: cd docs && ./show_undocumented.py doc-coverage.info
21 changes: 21 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
on:
workflow_call:
inputs:
flags:
type: string
default: ''
jobs:
test:
name: Test
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON ${{ inputs.flags }}
- name: Build
run: cmake --build build --target test
- name: Test
run: ./build/test/test
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ main
*.so
build/*
install/*
src/defines.hpp
inst-dir/*
src/defines.hpp
.vscode

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "data-sources/mt4g"]
path = data-sources/mt4g
url = https://github.com/caps-tum/mt4g.git
[submodule "test/ut"]
path = test/ut
url = git@github.com:boost-ext/ut.git
10 changes: 9 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ endif()

if(DATA_SOURCES OR DS_HWLOC)
find_package(HWLOC REQUIRED)
include_directories(${HWLOC_INCLUDE_DIRS})
endif()


Expand Down Expand Up @@ -64,6 +63,11 @@ option(DATA_SOURCES "Build and install all data sources" OFF)
option(DS_HWLOC "Build and install data source hwloc (Retrieves hwloc topology information)" OFF)
option(DS_MT4G "Build and install data source mt4g (Compute and memory topology of NVidia GPUs)" OFF)
option(DS_NUMA "Build and install data source caps-numa-benchmark" OFF)
option(TEST "Build tests" OFF)
option(TEST_ASAN "Build tests with enabled address sanitizers" OFF)
option(TEST_TSAN "Build tests with enabled thread sanitizers" OFF)
option(TEST_UBSAN "Build tests with enabled undefined behaviour sanitizers" OFF)
option(TEST_COVERAGE "Build tests with enabled coverage" OFF)

if(DATA_SOURCES)
set(DS_HWLOC ON)
Expand All @@ -75,3 +79,7 @@ endif()
add_subdirectory(src)
add_subdirectory(examples)
add_subdirectory(data-sources)

if(${TEST})
add_subdirectory(test)
endif()
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ cmake ..
make all install
```

## Testing

Please refer to the [Testing Guide](test/README.md) for more information.

## About

sys-sage has been created by Stepan Vanecek (stepan.vanecek@tum.de) and the [CAPS TUM](https://www.ce.cit.tum.de/en/caps/homepage/). Please contact us in case of questions, bug reporting etc.
Expand Down
4 changes: 3 additions & 1 deletion data-sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ if(DS_HWLOC)
endif()

add_executable(hwloc-output hwloc-output.cpp)
target_link_libraries(hwloc-output hwloc)
target_include_directories(hwloc-output PUBLIC ${HWLOC_INCLUDE_DIRS})
target_link_directories(hwloc-output PRIVATE ${HWLOC_LIBRARY_DIRS})
target_link_libraries(hwloc-output PRIVATE ${HWLOC_LIBRARIES})
install(TARGETS hwloc-output DESTINATION bin)
endif()

Expand Down
43 changes: 27 additions & 16 deletions data-sources/hwloc-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,40 @@ using namespace std;
string get_hwloc_topology_xml_string();

/**
Binary (entrypoint) for generating hwloc topology XML output (to current directory)
Binary (entrypoint) for generating hwloc topology XML output (to current directory). Functionality is almost identical to "lstopo --of XML" (with an option to store to a file).
\n usage: ./hwloc-output [output_filename]
@param filename of the output file (default: hwloc_topology.xml)
@param filename of the output file. If no output_filename is selected, print to stdout (also use "-" as output_filename to print to stdout)
*/

int main(int argc, char* argv[])
{

bool to_stdout = false;
string filename;
if (argc < 2) {
filename = "hwloc_topology.xml";
if (argc < 2 || std::strcmp(argv[1], "-") == 0 ) {
to_stdout = true;
}
else {
filename = argv[1];
}

string xml_output = get_hwloc_topology_xml_string();

if (!xml_output.empty()) {
ofstream outfile;
outfile.open(filename);
outfile << xml_output;
outfile.close();
//cout << "Hwloc XML output exported to " << filename << endl;
if(to_stdout)
{
std::cout << xml_output;
}
else
{
ofstream outfile;
outfile.open(filename);
outfile << xml_output;
outfile.close();
//cout << "Hwloc XML output exported to " << filename << endl;
}
}
else {
cerr << "Failed to generate hwloc topology XML output" << endl;
return 1;
}

return 0;
Expand Down Expand Up @@ -66,16 +74,19 @@ string get_hwloc_topology_xml_string() {
hwloc_topology_destroy(topology);
return "";
}
//TODO replace with hwloc_topology_export_xmlbuffer?
stringstream xml_output_stream;
err = hwloc_topology_export_xml(topology, xml_output_stream.str().c_str(), flags);
char * xmlbuffer;
int buflen;
err = hwloc_topology_export_xmlbuffer(topology, &xmlbuffer, &buflen, flags);
if (err) {
cerr << "hwloc: Failed to export xml" << endl;
cerr << "hwloc: Failed to export to a temporary buffer" << endl;
hwloc_free_xmlbuffer(topology, xmlbuffer);
hwloc_topology_destroy(topology);
return "";
}
std::string xml_output(xmlbuffer, buflen);

hwloc_free_xmlbuffer(topology, xmlbuffer);
hwloc_topology_destroy(topology);
string xml_output = xml_output_stream.str();

return xml_output;
}
14 changes: 14 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
test:
build:
context: test
dockerfile: Dockerfile
volumes:
- .:/sys-sage
entrypoint: [ "/bin/sh", "-c" ]
command:
- |
cmake -S /sys-sage -B /build -DCMAKE_BUILD_TYPE=Debug -DTEST=ON
cmake --build build --target test
./build/test/test
1 change: 1 addition & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
html/*
latex/*
xml/*
4 changes: 2 additions & 2 deletions docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -1849,7 +1849,7 @@ EXTRA_SEARCH_MAPPINGS =
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.

GENERATE_LATEX = YES
GENERATE_LATEX = NO

# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
Expand Down Expand Up @@ -2134,7 +2134,7 @@ MAN_LINKS = NO
# captures the structure of the code including all documentation.
# The default value is: NO.

GENERATE_XML = NO
GENERATE_XML = YES

# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
Expand Down
26 changes: 26 additions & 0 deletions docs/show_undocumented.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/usr/bin/env python3

# Shows undocumented symbols from the sys-sage project.
# Requires https://github.com/psycofdj/coverxygen, install via: pip3 install coverxygen
# Generate coverage file: python3 -m coverxygen --xml-dir xml --src-dir ../src/ --output doc-coverage.info --format json-v3

import sys
import json

if len(sys.argv) != 2:
print("Missing input file argument")
exit(-1)

cov = json.load(open(sys.argv[1]))
missing = 0
for file in cov['files']:
for sym in cov['files'][file]:
if not sym['documented'] and sym['kind'] not in ['file', 'namespace']:
print("[{}:{}] \033[0;33m{}\033[0m".format(
sym['file'], sym['line'], sym['symbol']
))
missing += 1

print(f"Undocumented symbols: {missing}")

exit(missing)
8 changes: 5 additions & 3 deletions examples/gpu-topo-parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ int main(int argc, char *argv[])
std::string path_prefix(argv[0]);
std::size_t found = path_prefix.find_last_of("/\\");
path_prefix=path_prefix.substr(0,found) + "/";
gpuTopoPath = path_prefix + "example_data/pascal_gpu_topo.csv";
gpuTopoPath = path_prefix + "example_data/ampere_gpu_topo.csv";
}
else if(argc == 2){
gpuTopoPath = argv[1];
Expand All @@ -42,9 +42,11 @@ int main(int argc, char *argv[])

string output_name = "sys-sage_gpu_sample_output.xml";
cout << "-------- Exporting as XML to " << output_name << " --------" << endl;

//topo->DeleteSubtree();
exportToXml(topo, output_name);

delete topo;
delete n;
topo->Delete(true);

return 0;
}
4 changes: 3 additions & 1 deletion examples/sys-sage-benchmarking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,9 @@ int main(int argc, char *argv[])
cout << ", mt4g_dataPaths, "<< mt4g_dataPaths;
cout << ", all_components, " << allComponentList.size() ;

cout << ", time_getNumaMaxBw, " << time_getNumaMaxBw; //<< "; bw; " << max_bw << "; ComponentId; " << max_bw_component->GetId() << endl;
cout << ", time_getNumaMaxBw, " << time_getNumaMaxBw;
if(false)
cout << "; bw; " << max_bw << "; ComponentId; " << max_bw_component->GetId() << endl;
cout << ", time_createNewComponent, " << time_createNewComponent;

cout << ", hwloc_component_size[B], " << hwloc_component_size;
Expand Down
44 changes: 25 additions & 19 deletions src/DataPath.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,23 @@
#include "defines.hpp"
#include "Topology.hpp"

//void AddDataPath(DataPath* p, int orientation);
#define SYS_SAGE_DATAPATH_NONE 1
#define SYS_SAGE_DATAPATH_OUTGOING 2
#define SYS_SAGE_DATAPATH_INCOMING 4
//Component pointing to a DataPath
#define SYS_SAGE_DATAPATH_NONE 1 /**< TODO */
#define SYS_SAGE_DATAPATH_OUTGOING 2 /**< This Component is the source DataPath. */
#define SYS_SAGE_DATAPATH_INCOMING 4 /**< This Component is the taerget DataPath. */

//int oriented
#define SYS_SAGE_DATAPATH_BIDIRECTIONAL 8
#define SYS_SAGE_DATAPATH_ORIENTED 16
#define SYS_SAGE_DATAPATH_BIDIRECTIONAL 8 /**< DataPath has no direction. */
#define SYS_SAGE_DATAPATH_ORIENTED 16 /**< DataPath is directec from the source to the target. */

//dp_type
#define SYS_SAGE_DATAPATH_TYPE_NONE 32
#define SYS_SAGE_DATAPATH_TYPE_LOGICAL 64
#define SYS_SAGE_DATAPATH_TYPE_PHYSICAL 128
#define SYS_SAGE_DATAPATH_TYPE_L3CAT 256
#define SYS_SAGE_DATAPATH_TYPE_MIG 512
#define SYS_SAGE_DATAPATH_TYPE_DATATRANSFER 1024
#define SYS_SAGE_DATAPATH_TYPE_C2C 2048
#define SYS_SAGE_DATAPATH_TYPE_NONE 32 /**< Generic type of DataPath */
#define SYS_SAGE_DATAPATH_TYPE_LOGICAL 64 /**< DataPath describes a logical connection/relation of two Components. */
#define SYS_SAGE_DATAPATH_TYPE_PHYSICAL 128 /**< DataPath describes a physical/hardware connection/relation of two Components. */
#define SYS_SAGE_DATAPATH_TYPE_L3CAT 256 /**< DataPath type describing Cache partitioning settings. */
#define SYS_SAGE_DATAPATH_TYPE_MIG 512 /**< DataPath type describing GPU partitioning settings. */
#define SYS_SAGE_DATAPATH_TYPE_DATATRANSFER 1024 /**< DataPath type describing data transfer attributes. */
#define SYS_SAGE_DATAPATH_TYPE_C2C 2048 /**< DataPath type describing cache-to-cache latencies (cccbench data source). */

using namespace std;
class Component;
Expand Down Expand Up @@ -103,6 +103,9 @@ class DataPath {
@see dp_type
*/
int GetDpType();
/**
* TODO
*/
int GetOriented();

/**
Expand All @@ -117,16 +120,19 @@ class DataPath {
*/
void DeleteDataPath();

/**
* TODO
*/
map<string,void*> attrib;
private:
Component * source;
Component * target;
Component * source; /**< TODO */
Component * target; /**< TODO */

const int oriented;
const int dp_type; /**< asdasd */
const int oriented; /**< TODO */
const int dp_type; /**< TODO */

double bw;
double latency;
double bw; /**< TODO */
double latency; /**< TODO */

};

Expand Down
Loading