Fix compilation errors and enhance Makefile
This commit is contained in:
14
Makefile
14
Makefile
@@ -6,6 +6,13 @@ f_release = build_Release
|
|||||||
f_debug = build_Debug
|
f_debug = build_Debug
|
||||||
app_targets = b_best b_list b_main b_manage b_grid b_results
|
app_targets = b_best b_list b_main b_manage b_grid b_results
|
||||||
test_targets = unit_tests_platform
|
test_targets = unit_tests_platform
|
||||||
|
# Set the number of parallel jobs to the number of available processors minus 7
|
||||||
|
CPUS := $(shell getconf _NPROCESSORS_ONLN 2>/dev/null \
|
||||||
|
|| nproc --all 2>/dev/null \
|
||||||
|
|| sysctl -n hw.ncpu)
|
||||||
|
|
||||||
|
# --- Your desired job count: CPUs – 7, but never less than 1 --------------
|
||||||
|
JOBS := $(shell n=$(CPUS); [ $${n} -gt 7 ] && echo $$((n-7)) || echo 1)
|
||||||
|
|
||||||
define ClearTests
|
define ClearTests
|
||||||
@for t in $(test_targets); do \
|
@for t in $(test_targets); do \
|
||||||
@@ -25,6 +32,8 @@ define build_target
|
|||||||
@if [ -d $(2) ]; then rm -fr $(2); fi
|
@if [ -d $(2) ]; then rm -fr $(2); fi
|
||||||
@conan install . --build=missing -of $(2) -s build_type=$(1)
|
@conan install . --build=missing -of $(2) -s build_type=$(1)
|
||||||
@cmake -S . -B $(2) -DCMAKE_TOOLCHAIN_FILE=$(2)/build/$(1)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(1) -D$(3)
|
@cmake -S . -B $(2) -DCMAKE_TOOLCHAIN_FILE=$(2)/build/$(1)/generators/conan_toolchain.cmake -DCMAKE_BUILD_TYPE=$(1) -D$(3)
|
||||||
|
@echo ">>> Will build using $(JOBS) parallel jobs"
|
||||||
|
echo ">>> Done"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define compile_target
|
define compile_target
|
||||||
@@ -34,14 +43,15 @@ define compile_target
|
|||||||
else \
|
else \
|
||||||
target=""; \
|
target=""; \
|
||||||
fi
|
fi
|
||||||
@cmake --build $(2) --config $(1) --parallel $(target)
|
@cmake --build $(2) --config $(1) --parallel $(JOBS) $(target)
|
||||||
|
@echo ">>> Done"
|
||||||
endef
|
endef
|
||||||
|
|
||||||
init: ## Initialize the project installing dependencies
|
init: ## Initialize the project installing dependencies
|
||||||
@echo ">>> Installing dependencies with Conan"
|
@echo ">>> Installing dependencies with Conan"
|
||||||
@conan install . --output-folder=build --build=missing -s build_type=Release
|
@conan install . --output-folder=build --build=missing -s build_type=Release
|
||||||
@conan install . --output-folder=build_debug --build=missing -s build_type=Debug
|
@conan install . --output-folder=build_debug --build=missing -s build_type=Debug
|
||||||
@echo ">>> Done";
|
@echo ">>> Done"
|
||||||
|
|
||||||
clean: ## Clean the project
|
clean: ## Clean the project
|
||||||
@echo ">>> Cleaning the project..."
|
@echo ">>> Cleaning the project..."
|
||||||
|
@@ -21,7 +21,7 @@ add_executable(
|
|||||||
experimental_clfs/DecisionTree.cpp
|
experimental_clfs/DecisionTree.cpp
|
||||||
experimental_clfs/AdaBoost.cpp
|
experimental_clfs/AdaBoost.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(b_best Boost::boost "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy "${XLSXWRITER_LIB}")
|
target_link_libraries(b_best Boost::boost "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy libxlsxwriter::libxlsxwriter)
|
||||||
|
|
||||||
# b_grid
|
# b_grid
|
||||||
set(grid_sources GridSearch.cpp GridData.cpp GridExperiment.cpp GridBase.cpp )
|
set(grid_sources GridSearch.cpp GridData.cpp GridExperiment.cpp GridBase.cpp )
|
||||||
@@ -49,7 +49,7 @@ add_executable(b_list commands/b_list.cpp
|
|||||||
experimental_clfs/DecisionTree.cpp
|
experimental_clfs/DecisionTree.cpp
|
||||||
experimental_clfs/AdaBoost.cpp
|
experimental_clfs/AdaBoost.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(b_list "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy "${XLSXWRITER_LIB}")
|
target_link_libraries(b_list "${PyClassifiers}" bayesnet::bayesnet argparse::argparse fimdlp::fimdlp ${Python3_LIBRARIES} torch::torch Boost::python Boost::numpy libxlsxwriter::libxlsxwriter)
|
||||||
|
|
||||||
# b_main
|
# b_main
|
||||||
set(main_sources Experiment.cpp Models.cpp HyperParameters.cpp Scores.cpp ArgumentsExperiment.cpp)
|
set(main_sources Experiment.cpp Models.cpp HyperParameters.cpp Scores.cpp ArgumentsExperiment.cpp)
|
||||||
@@ -76,8 +76,8 @@ add_executable(
|
|||||||
results/Result.cpp results/ResultsDataset.cpp results/ResultsDatasetConsole.cpp
|
results/Result.cpp results/ResultsDataset.cpp results/ResultsDatasetConsole.cpp
|
||||||
main/Scores.cpp
|
main/Scores.cpp
|
||||||
)
|
)
|
||||||
target_link_libraries(b_manage torch::torch "${XLSXWRITER_LIB}" fimdlp::fimdlp bayesnet::bayesnet argparse::argparse)
|
target_link_libraries(b_manage torch::torch libxlsxwriter::libxlsxwriter fimdlp::fimdlp bayesnet::bayesnet argparse::argparse)
|
||||||
|
|
||||||
# b_results
|
# b_results
|
||||||
add_executable(b_results commands/b_results.cpp)
|
add_executable(b_results commands/b_results.cpp)
|
||||||
target_link_libraries(b_results torch::torch "${XLSXWRITER_LIB}" fimdlp::fimdlp bayesnet::bayesnet argparse::argparse)
|
target_link_libraries(b_results torch::torch libxlsxwriter::libxlsxwriter fimdlp::fimdlp bayesnet::bayesnet argparse::argparse)
|
||||||
|
@@ -7,8 +7,12 @@
|
|||||||
#include <vector>
|
#include <vector>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
#include <cmath>
|
||||||
|
#include <ctime>
|
||||||
|
#include <iomanip>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
extern char **environ;
|
extern char** environ;
|
||||||
|
|
||||||
namespace platform {
|
namespace platform {
|
||||||
static std::string trim(const std::string& str)
|
static std::string trim(const std::string& str)
|
||||||
|
Reference in New Issue
Block a user