Code lint
This commit is contained in:
@@ -19,26 +19,9 @@ class Compiler {
|
||||
std::string library_version;
|
||||
std::filesystem::path library_root_path;
|
||||
|
||||
static void collect_files(const std::filesystem::path& dir,
|
||||
std::vector<std::filesystem::path>& out) {
|
||||
// We met ABI breakage using std::filesystem::recursive_directory_iterator
|
||||
// Use std::filesystem::directory_iterator instead
|
||||
for (const auto& entry : std::filesystem::directory_iterator(dir)) {
|
||||
if (entry.is_directory()) {
|
||||
collect_files(entry.path(), out);
|
||||
} else if (entry.is_regular_file() && entry.path().extension()==".cuh") {
|
||||
out.emplace_back(entry.path());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string get_library_version() const {
|
||||
std::vector<std::filesystem::path> files;
|
||||
collect_files(library_include_path / "deep_gemm", files);
|
||||
std::sort(files.begin(), files.end());
|
||||
|
||||
std::stringstream ss;
|
||||
for (const auto& f : files) {
|
||||
for (const auto& f: collect_files(library_include_path / "deep_gemm")) {
|
||||
std::ifstream in(f, std::ios::binary);
|
||||
ss << in.rdbuf();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <random>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
@@ -41,6 +42,25 @@ static std::tuple<int, std::string> call_external_command(std::string command) {
|
||||
return {exit_code, output};
|
||||
}
|
||||
|
||||
static std::vector<std::filesystem::path> collect_files(const std::filesystem::path& root) {
|
||||
std::vector<std::filesystem::path> files;
|
||||
std::function<void(const std::filesystem::path&)> impl;
|
||||
impl = [&](const std::filesystem::path& dir) {
|
||||
for (const auto& entry: std::filesystem::directory_iterator(dir)) {
|
||||
if (entry.is_directory()) {
|
||||
impl(entry.path());
|
||||
} else if (entry.is_regular_file() and entry.path().extension() == ".cuh") {
|
||||
files.emplace_back(entry.path());
|
||||
}
|
||||
}
|
||||
};
|
||||
impl(root);
|
||||
|
||||
// Be consistent
|
||||
std::sort(files.begin(), files.end());
|
||||
return files;
|
||||
}
|
||||
|
||||
static std::filesystem::path make_dirs(const std::filesystem::path& path) {
|
||||
// OK if existed
|
||||
std::error_code capture;
|
||||
|
||||
Reference in New Issue
Block a user