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

Code style enforcing #95

Merged
merged 168 commits into from
Dec 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
168 commits
Select commit Hold shift + click to select a range
f67729b
enable compile commands generation
marenz2569 Sep 19, 2024
f24a0b2
add .clang-format file base on LLVM style
marenz2569 Sep 19, 2024
9732bdb
clang-format
marenz2569 Sep 19, 2024
f4fd0ec
ignore clang-format in blame
marenz2569 Sep 19, 2024
de5ffd6
add clang-format ci job
marenz2569 Sep 19, 2024
7473e5f
add .cache folder to gitignore
marenz2569 Sep 19, 2024
c513d31
add .clang-tidy
marenz2569 Sep 19, 2024
29df30a
disable clang-tidy extension that causes crash
marenz2569 Sep 24, 2024
f3960af
add clang-tidy workflow
marenz2569 Sep 24, 2024
742712e
Merge remote-tracking branch 'origin/master' into code-style-enforcing
marenz2569 Sep 24, 2024
b79754e
first pass of clang-tidy for the header files
marenz2569 Sep 24, 2024
37a8518
update .clang-tidy
marenz2569 Sep 27, 2024
90beb59
add an empty file as a workaround for clangd issue
marenz2569 Sep 27, 2024
ff6113b
second pass of clang-tidy for the header files. use unique_ptr for th…
marenz2569 Sep 27, 2024
c33291f
clang-tidy workflow: add .clang-tidy file location
marenz2569 Sep 27, 2024
a3b01b1
clang-tidy workflow: update .clang-tidy file location
marenz2569 Sep 27, 2024
d53a107
clang-tidy workflow: add comment and rum build before clang-tidy
marenz2569 Sep 27, 2024
fafd720
clang-tidy workflow: update fetch depth
marenz2569 Sep 27, 2024
6e4c880
clang-tidy workflow: clone with submodules
marenz2569 Sep 27, 2024
770b405
first pass of clang-tidy for the source files
marenz2569 Oct 2, 2024
1d98664
clang-tidy: allow big functions
marenz2569 Oct 3, 2024
5aa731a
use enum class for constants
marenz2569 Oct 3, 2024
334b872
clang-tidy: disable checks in lib folder
marenz2569 Oct 3, 2024
6b388f6
refactor cpp side memory management of the high-load function. remove…
marenz2569 Oct 4, 2024
3876411
fix divission by zero warning
marenz2569 Oct 4, 2024
ba43956
clang-tidy fixes. create struct for allocating whole cache lines. cle…
marenz2569 Oct 5, 2024
962c0da
clang-tidy fixes
marenz2569 Oct 5, 2024
5e04c5d
cleanup load worker thread
marenz2569 Oct 5, 2024
43fd6cb
refactor load worker data
marenz2569 Oct 5, 2024
d608e98
use std::chrono::microseconds instead of uint64_t
marenz2569 Oct 5, 2024
5583723
use throw instead of returns for Environment class
marenz2569 Oct 5, 2024
8ba518a
clang-tidy fixes
marenz2569 Oct 5, 2024
e87ef3c
remove some ifdefs. clang-tidy fixes
marenz2569 Oct 6, 2024
7208aeb
remove more ifdefs
marenz2569 Oct 6, 2024
3f32f6f
remove more ifdefs
marenz2569 Oct 6, 2024
35a73b1
remove more ifdefs
marenz2569 Oct 6, 2024
6fdcf47
remove more ifdefs
marenz2569 Oct 6, 2024
4da8714
remove more ifdefs
marenz2569 Oct 6, 2024
05ab312
remove more ifdefs
marenz2569 Oct 6, 2024
f58bfd5
fix mingw compatibility
marenz2569 Oct 6, 2024
f0e9439
fix some MSC errors
marenz2569 Oct 6, 2024
230103d
fix errors in MSC compile
marenz2569 Oct 7, 2024
bfc2167
fix errors in MSC compile
marenz2569 Oct 7, 2024
bc3e37d
add inline to functions define in the windows compat header
marenz2569 Oct 7, 2024
4910835
AlignedAlloc: try to fix infinite recursion in free function
marenz2569 Oct 7, 2024
6169843
WindowsCompat: fix _mm_mfence compatibilty
marenz2569 Oct 7, 2024
33fc035
fix Firestarter.cpp includes
marenz2569 Oct 7, 2024
7799e06
WindowsCompat: fix _mm_mfence compatibilty
marenz2569 Oct 7, 2024
e7efd15
WindowsCompat: fix _mm_mfence compatibilty
marenz2569 Oct 8, 2024
c29ccf8
fix static build
marenz2569 Oct 8, 2024
21c10be
fix get_current_dir_name in apple build
marenz2569 Oct 8, 2024
e8370bf
fix get_current_dir_name in apple build
marenz2569 Oct 8, 2024
e196bf2
cleanup cuda and hip code
marenz2569 Oct 16, 2024
eb0d6e5
Cuda: rename accellSafeCall
marenz2569 Oct 16, 2024
b961fb8
fix some cuda compile errors
marenz2569 Oct 17, 2024
0edf8d7
fix some cuda compile errors
marenz2569 Oct 17, 2024
4307b13
fix some cuda compile errors
marenz2569 Oct 17, 2024
14786a3
cuda/hip compat: replace some static_assert with assert to cope with …
marenz2569 Oct 18, 2024
73f3d88
ci: set cxx compiler correctly for openapi build
marenz2569 Oct 18, 2024
47fc326
windowscompat: remove inline
marenz2569 Oct 18, 2024
0e4fea0
remove compile error
marenz2569 Oct 18, 2024
a788273
windows compat: remove anonymous namespace for __cpuid and _mm_mfence
marenz2569 Oct 18, 2024
5912cb4
windows compat: remove anonymous namespaces from header
marenz2569 Oct 18, 2024
20b6360
ci: do not fail fast in linux build
marenz2569 Oct 18, 2024
aefe54c
windowscompat: use static inline
marenz2569 Oct 18, 2024
99c03f9
fix oneapi
marenz2569 Oct 18, 2024
c9d57c1
windows compat: efix compatibility with icx
marenz2569 Oct 18, 2024
4b652fd
remove warning
marenz2569 Oct 18, 2024
def3a9f
Revert "ci: set cxx compiler correctly for openapi build"
marenz2569 Oct 18, 2024
8973ddf
fix hip/cuda compat layer
marenz2569 Oct 18, 2024
b396920
fix problem with metric interface and hip compile
marenz2569 Oct 18, 2024
e3b01db
windows compat: fix hip build
marenz2569 Oct 18, 2024
a2f6033
fix link errors with metric interface restructure
marenz2569 Oct 18, 2024
ddd4b5e
fix windows msc build
marenz2569 Oct 18, 2024
f8a3bc5
fix windows msc build
marenz2569 Oct 18, 2024
e2cba76
windows compat: add #pragma message to debug _mm_mfence compatibility
marenz2569 Oct 19, 2024
78272ad
windows compat: add emmintrin.h header when compiling with clang.
marenz2569 Oct 19, 2024
30aceef
Revert "windows compat: add #pragma message to debug _mm_mfence compa…
marenz2569 Oct 19, 2024
d62dc1a
windows compat: less compiler warnings
marenz2569 Oct 19, 2024
ddfc1ae
Revert "ci: do not fail fast in linux build"
marenz2569 Oct 19, 2024
1fd90f4
restructure rapl: add callback back in again
marenz2569 Oct 19, 2024
6696817
cleanup cuda/hip and openapi code. add todo comments with links to t…
marenz2569 Oct 24, 2024
6b50a28
fix cuda compat layer
marenz2569 Oct 24, 2024
3e13ca0
remove redundant reinterpret cast
marenz2569 Oct 24, 2024
6e57460
fix cast in cuda compat malloc function
marenz2569 Oct 24, 2024
a0591db
fix cast in cuda compat malloc/free functions
marenz2569 Oct 24, 2024
0921c1f
fix oneapi refactor
marenz2569 Oct 24, 2024
a77e429
refactor oneapi code
marenz2569 Oct 24, 2024
77fec86
refactor oneapi code
marenz2569 Oct 24, 2024
badd0fe
add script to start clang-tidy
marenz2569 Oct 25, 2024
5c8f6c3
update clang-tidy ci action
marenz2569 Oct 25, 2024
93512a5
update todos
marenz2569 Oct 25, 2024
049d183
run clang-tidy useing 2 cores
marenz2569 Oct 25, 2024
dc5c9dc
clang-tidy: scramble files to reduce the runtime
marenz2569 Oct 25, 2024
4db1a5b
ci: run build before executing clang-tidy
marenz2569 Oct 25, 2024
e6ae34d
clang-tidy start with shell
marenz2569 Oct 25, 2024
4ae98e3
clang-tidy: launch processes in new python thread
marenz2569 Oct 25, 2024
2c26deb
run clang-tidy ci with 4 cores
marenz2569 Oct 25, 2024
077662a
clang-tidy: find the correct source files for the current build
marenz2569 Oct 25, 2024
ae95982
remove error message from cuda/hip compat header
marenz2569 Oct 25, 2024
25571c1
reformat clang-tidy
marenz2569 Oct 25, 2024
b9b468e
clang-tidy: use seed for shuffled files
marenz2569 Oct 25, 2024
219a262
clang-tidy: add check to ci action
marenz2569 Oct 25, 2024
5c4cb4c
clang-tidy: set python unbuffered in ci action
marenz2569 Oct 25, 2024
d978ca9
refactor config parser
marenz2569 Oct 26, 2024
f774833
reorder config fields
marenz2569 Oct 26, 2024
954bb30
do not access moved object
marenz2569 Oct 26, 2024
f1f8828
X86 payloads: remove using. fix deprecation warning.
marenz2569 Oct 26, 2024
6a6e261
remove unused variable
marenz2569 Oct 26, 2024
2443465
thin out payload class
marenz2569 Oct 26, 2024
48cc7a8
remove protected member
marenz2569 Oct 26, 2024
0742466
remove protected data members. fix clang-tidy warnings
marenz2569 Oct 26, 2024
73ee17b
fix clang-tidy warnings
marenz2569 Oct 26, 2024
bcd588b
remove warnings
marenz2569 Oct 27, 2024
295e538
fix string compare in default cpu frequency lookup
marenz2569 Oct 27, 2024
e7222db
fix more warnings
marenz2569 Oct 27, 2024
6f52af8
Perf: fix warnings
marenz2569 Oct 27, 2024
c05f47b
rapl: fix warnings
marenz2569 Oct 27, 2024
aac47aa
DumpRegisterStruct: fix warnings
marenz2569 Oct 27, 2024
ef90525
use shared ptr for payload. less clone(). make functions in payload p…
marenz2569 Oct 27, 2024
d9b2979
remove warnings
marenz2569 Oct 28, 2024
ba314d7
remove clone from payload
marenz2569 Oct 28, 2024
0dbe9d2
fix build with gcc
marenz2569 Oct 28, 2024
041acfe
replace std::quick_exit with a custom thread safe exit function
marenz2569 Oct 28, 2024
54fd662
refactor PlatformConfig and settings for the Payload. remove more non…
marenz2569 Oct 28, 2024
af06097
clang-tidy fixes
marenz2569 Oct 29, 2024
a6d9c3f
cleanup clang-tidy script
marenz2569 Oct 29, 2024
f8af514
make Config and Topology private in Environment class
marenz2569 Oct 29, 2024
738933f
clang-tidy: fix warnings
marenz2569 Oct 30, 2024
a218aad
add todo note
marenz2569 Oct 30, 2024
7362553
clang-tidy: fix warnings
marenz2569 Oct 30, 2024
6ad9537
clang-tidy fixes
marenz2569 Oct 31, 2024
de5bc81
clang-tidy: disable warnings from asmjit
marenz2569 Nov 2, 2024
7e0ee18
clang-tidy: fix issues in MeasurementWorker
marenz2569 Nov 2, 2024
42bfb04
clang-tidy: fixes
marenz2569 Nov 3, 2024
ef3b634
clang-tidy: nolint unnecessary warnings
marenz2569 Nov 4, 2024
d954fe9
add docstrings for cuda
marenz2569 Nov 5, 2024
523a1f4
move compiled payload into a new header. add docstrings for payload c…
marenz2569 Nov 5, 2024
ac82234
move functions for sequences of items into payloadsettings
marenz2569 Nov 5, 2024
d5c0311
add more documentation to the payload and platform
marenz2569 Nov 5, 2024
235e92b
refactor payload. add docstrings
marenz2569 Nov 6, 2024
982e2ca
add more docstrings
marenz2569 Nov 7, 2024
23ccb55
docstrings
marenz2569 Nov 7, 2024
5a301a3
add docstrings
marenz2569 Nov 7, 2024
e72b010
add docstrings
marenz2569 Nov 7, 2024
ad22452
change log error to log warn to not abort on failed metric init
marenz2569 Nov 7, 2024
7498853
add docstrings for measurement and metrics
marenz2569 Nov 8, 2024
eef129f
fix refactor in rapl metric
marenz2569 Nov 8, 2024
bbe6f57
rapl metric docstrings
marenz2569 Nov 8, 2024
283ec47
remove unused return argument in watchdogworker
marenz2569 Nov 8, 2024
dc6c80a
add docstrings to OneAPI
marenz2569 Nov 8, 2024
cfc2cf1
doc strings and rename funtions in optimization
marenz2569 Nov 8, 2024
29168c2
cleanup optimization worker. add docstrings
marenz2569 Nov 8, 2024
1690ec0
ci: remove GHC artifacts to make more space for the rocm build
marenz2569 Nov 8, 2024
dee9fc1
explicitly check if number of GPUs is not equal to 0.
marenz2569 Nov 8, 2024
9c32916
update docstring in cuda and oneapi files
marenz2569 Nov 8, 2024
08a3772
add docstring for config
marenz2569 Nov 8, 2024
0de3fa6
fix offset in error detection algorithm. add docstrings
marenz2569 Nov 8, 2024
427675a
docstring for DumpRegisterWorkerData
marenz2569 Nov 8, 2024
e04716f
add docstrings to Firestarter.hpp
marenz2569 Nov 8, 2024
32f1399
fix bug saving json in history
marenz2569 Nov 16, 2024
f045530
update comment in X86PlatformConfig.cpp
marenz2569 Nov 16, 2024
b16aa6a
fix MiB print in cuda
marenz2569 Nov 19, 2024
0fce1bb
unify firestarter includes for source files
marenz2569 Nov 19, 2024
9155ae2
fix crash when optimization is stoped
marenz2569 Nov 20, 2024
eb8eed7
unify firestarter includes in header files
marenz2569 Nov 21, 2024
92897b2
remove ifndefs
marenz2569 Nov 21, 2024
f53b736
silence modernice warning in c-style header
marenz2569 Nov 22, 2024
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
Prev Previous commit
Next Next commit
docstrings
marenz2569 committed Nov 7, 2024
commit 23ccb55c007c8371e5cf199983cdb6ace429e54b
51 changes: 41 additions & 10 deletions include/firestarter/Environment/CPUTopology.hpp
Original file line number Diff line number Diff line change
@@ -34,57 +34,88 @@ extern "C" {

namespace firestarter::environment {

/// This class models the properties of a processor.
class CPUTopology {
public:
explicit CPUTopology(std::string Architecture);
virtual ~CPUTopology();

friend auto operator<<(std::ostream& Stream, CPUTopology const& CpuTopologyRef) -> std::ostream&;

/// The total number of hardware threads.
[[nodiscard]] auto numThreads() const -> unsigned { return NumThreadsPerCore * NumCoresTotal; }
/// The maximum os_index of all PUs plus 1 if we cannot determine the number of cpu kinds. Otherwise the maximum
/// number of PUs.
[[nodiscard]] auto maxNumThreads() const -> unsigned;
/// Assuming we have a consistent number of threads per core. The number of thread per core.
[[nodiscard]] auto numThreadsPerCore() const -> unsigned { return NumThreadsPerCore; }
/// The total number of cores.
[[nodiscard]] auto numCoresTotal() const -> unsigned { return NumCoresTotal; }
/// The total number of packages.
[[nodiscard]] auto numPackages() const -> unsigned { return NumPackages; }

/// The CPU architecture e.g., x86_64
[[nodiscard]] auto architecture() const -> std::string const& { return Architecture; }
/// The CPU vendor i.e., Intel or AMD.
[[nodiscard]] virtual auto vendor() const -> std::string const& { return Vendor; }
/// The processor name, this includes the vendor specific name
[[nodiscard]] virtual auto processorName() const -> std::string const& { return ProcessorName; }
[[nodiscard]] virtual auto model() const -> std::string const& { return Model; }
/// The model of the processor. With X86 this is the the string of Family, Model and Stepping.
[[nodiscard]] virtual auto model() const -> std::string const& = 0;

// get the size of the L1i-cache in bytes
/// Getter for the L1i-cache size in bytes
[[nodiscard]] auto instructionCacheSize() const -> const auto& { return InstructionCacheSize; }

// return the cpu clockrate in Hz
/// Getter for the clockrate in Hz
[[nodiscard]] virtual auto clockrate() const -> uint64_t { return Clockrate; }
// return the cpu features

/// Getter for the list of CPU features
[[nodiscard]] virtual auto features() const -> std::list<std::string> const& = 0;

// get a timestamp
/// Get the current hardware timestamp
[[nodiscard]] virtual auto timestamp() const -> uint64_t = 0;

[[nodiscard]] auto getPkgIdFromPU(unsigned Pu) const -> std::optional<unsigned>;
/// Get the logical index of the core that housed the PU which is described by the os index.
/// \arg Pu The os index of the thread.
/// \returns Optionally the logical index of the CPU that houses this hardware thread.
[[nodiscard]] auto getCoreIdFromPU(unsigned Pu) const -> std::optional<unsigned>;

/// Get the logical index of the package that housed the PU which is described by the os index.
/// \arg Pu The os index of the thread.
/// \returns Optionally the logical index of the package that houses this hardware thread.
[[nodiscard]] auto getPkgIdFromPU(unsigned Pu) const -> std::optional<unsigned>;

protected:
/// Read the scaling_govenor file of cpu0 on linux and return the contents as a string.
[[nodiscard]] static auto scalingGovernor() -> std::string;

/// Print the information about this process to a stream.
[[nodiscard]] auto print(std::ostream& Stream) const -> std::ostream&;

private:
/// The Vendor name of the CPU.
/// The CPU vendor i.e., Intel or AMD.
std::string Vendor;
/// The Model name of the CPU.
std::string Model;

/// Helper function to open a filepath and return a stringstream with its contents.
/// \arg FilePath The file to open
/// \returns A stringstream with the contents of the file.
[[nodiscard]] static auto getFileAsStream(std::string const& FilePath) -> std::stringstream;

/// Assuming we have a consistent number of threads per core. The number of thread per core.
unsigned NumThreadsPerCore;
/// The total number of cores.
unsigned NumCoresTotal;
/// The total number of packages.
unsigned NumPackages;

/// The CPU architecture e.g., x86_64
std::string Architecture;
/// The processor name, this includes the vendor specific name
std::string ProcessorName;
/// The optional size of the instruction cache per core.
std::optional<unsigned> InstructionCacheSize;
/// Clockrate of the CPU in Hz
uint64_t Clockrate = 0;
/// The hwloc topology that is used to query information about the processor.
hwloc_topology_t Topology{};
};

23 changes: 20 additions & 3 deletions include/firestarter/Environment/X86/X86CPUTopology.hpp
Original file line number Diff line number Diff line change
@@ -27,40 +27,57 @@

namespace firestarter::environment::x86 {

/// This class models the properties of a x86_64 processor.
class X86CPUTopology final : public CPUTopology {
public:
X86CPUTopology();

friend auto operator<<(std::ostream& Stream, X86CPUTopology const& CpuTopology) -> std::ostream&;

/// Getter for the list of CPU features
[[nodiscard]] auto features() const -> std::list<std::string> const& override { return this->FeatureList; }
/// Getter for the CPU features class from asmjit
[[nodiscard]] auto featuresAsmjit() const -> const asmjit::CpuFeatures& { return this->CpuInfo.features(); }

/// Getter for the clockrate in Hz
[[nodiscard]] auto clockrate() const -> uint64_t override;

/// Get the current hardware timestamp
[[nodiscard]] auto timestamp() const -> uint64_t override;

/// The family id of the x86 processor
[[nodiscard]] auto familyId() const -> unsigned { return this->CpuInfo.familyId(); }
/// The model id of the x86 processor
[[nodiscard]] auto modelId() const -> unsigned { return this->CpuInfo.modelId(); }
/// The stepping id of the x86 processor
[[nodiscard]] auto stepping() const -> unsigned { return this->CpuInfo.stepping(); }

/// The CPU vendor i.e., Intel or AMD.
[[nodiscard]] auto vendor() const -> std::string const& final { return Vendor; }
/// Get the string containing family, model and stepping ids.
[[nodiscard]] auto model() const -> std::string const& final { return Model; }

private:
/// Does this processor support timestamp counters
[[nodiscard]] auto hasRdtsc() const -> bool { return this->HasRdtsc; }
/// Does this processor have invariant timestamp counters
[[nodiscard]] auto hasInvariantRdtsc() const -> bool { return this->HasInvariantRdtsc; }

/// A wrapper to the cpuid call to keep a consitent interface between Windows and other platforms.
static void cpuid(uint64_t* Rax, uint64_t* Rbx, uint64_t* Rcx, uint64_t* Rdx);

/// The asmjit CpuInfo for the current processor
asmjit::CpuInfo CpuInfo;
/// The list of cpufeatures that are supported by the current processpr
std::list<std::string> FeatureList;

/// Does this processor support timestamp counters
bool HasRdtsc;
/// Does this processor have invariant timestamp counters
bool HasInvariantRdtsc;

/// The Vendor name of the CPU.
/// The CPU vendor i.e., Intel or AMD.
std::string Vendor;
/// The Model name of the CPU.
/// Model string containing family, model and stepping ids.
std::string Model;
};