diff --git a/homework_2/Makefile b/homework_2/Makefile index 7bae436..6d51bfb 100644 --- a/homework_2/Makefile +++ b/homework_2/Makefile @@ -45,18 +45,18 @@ DEP_DIR := $(BUILD_DIR)/.dep # ========== Compiler settings ========== # Compiler flags for debug and release -DEB_CFLAGS := -DDEBUG -g3 -Wall -Wextra -std=c11 #-fopenmp -REL_CFLAGS := -Wall -Wextra -O3 -std=c11 #-fopenmp -DEB_CXXFLAGS := -DDEBUG -g3 -Wall -Wextra -std=c++17 #-fopenmp -REL_CXXFLAGS := -Wall -Wextra -O3 -std=c++17 #-fopenmp +DEB_CFLAGS := -DDEBUG -g3 -Wall -Wextra -std=c11 -fopenmp +REL_CFLAGS := -Wall -Wextra -O3 -std=c11 -fopenmp +DEB_CXXFLAGS := -DDEBUG -g3 -Wall -Wextra -std=c++17 -fopenmp +REL_CXXFLAGS := -Wall -Wextra -O3 -std=c++17 -fopenmp # Pre-defines # PRE_DEFS := MYCAB=1729 SUPER_MODE -PRE_DEFS := #_GLIBCXX_PARALLEL +PRE_DEFS := _GLIBCXX_PARALLEL # ============== Linker settings ============== # Linker flags (example: -pthread -lm) -LDFLAGS := -pthread # -fopenmp +LDFLAGS := -pthread -fopenmp # Map output file MAP_FILE := output.map diff --git a/homework_2/hpc/btN1P4T4Q24.sh b/homework_2/hpc/btN1P4T4Q24.sh index 823193e..cc26e1e 100644 --- a/homework_2/hpc/btN1P4T4Q24.sh +++ b/homework_2/hpc/btN1P4T4Q24.sh @@ -10,7 +10,8 @@ # $> sbatch # # NOTE: -# First compile with +# First compile in aristotel with +# $> module load gcc/9.2.0 openmpi/4.0.3 # $> make -j hpc-build # diff --git a/homework_2/include/distsort.hpp b/homework_2/include/distsort.hpp index 680c515..d2ce369 100644 --- a/homework_2/include/distsort.hpp +++ b/homework_2/include/distsort.hpp @@ -12,7 +12,7 @@ #include #include -//#include +#include #include #include #if !defined DEBUG @@ -162,10 +162,10 @@ template void fullSort(RangeT& data, bool ascending) noexcept { // Use introsort from stdlib++ here, unless ... __gnu_parallel if (ascending) { - std::sort(data.begin(), data.end(), std::less<>()); + __gnu_parallel::sort(data.begin(), data.end(), std::less<>()); } else { - std::sort(data.begin(), data.end(), std::greater<>()); + __gnu_parallel::sort(data.begin(), data.end(), std::greater<>()); } } diff --git a/homework_2/include/utils.hpp b/homework_2/include/utils.hpp index 19e2566..657f276 100644 --- a/homework_2/include/utils.hpp +++ b/homework_2/include/utils.hpp @@ -357,32 +357,13 @@ private: }; /*! - * Utility high level function to forward a function call to std::invoke and measure + * Utility high level function like to forward a function call and measure * the excecution time - * - * @tparam Func The function type - * @tparam Args The argument - * @param func - * @param args - * @return */ - - #define timeCall(Tim, Func, ...) \ -Tim.start(); \ -Func(__VA_ARGS__); \ -Tim.stop(); \ - - -//template -//auto timeCall_r(Ret& ret, Func&& func, Args&&... args) { -// Timing timer; -// -// timer.start(); -// ret = std::invoke(std::forward(func), std::forward(args)...); -// timer.stop(); -// -// return timer.dt(); -//} + Tim.start(); \ + Func(__VA_ARGS__); \ + Tim.stop(); \ + #endif /* UTILS_HPP_ */