Ver código fonte

HW2: RC2 - Parallel Full Sort

tags/v2.0
Christos Choutouridis 2 semanas atrás
pai
commit
bc98ef4e9f
4 arquivos alterados com 16 adições e 34 exclusões
  1. +6
    -6
      homework_2/Makefile
  2. +2
    -1
      homework_2/hpc/btN1P4T4Q24.sh
  3. +3
    -3
      homework_2/include/distsort.hpp
  4. +5
    -24
      homework_2/include/utils.hpp

+ 6
- 6
homework_2/Makefile Ver arquivo

@@ -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


+ 2
- 1
homework_2/hpc/btN1P4T4Q24.sh Ver arquivo

@@ -10,7 +10,8 @@
# $> sbatch <this file>
#
# NOTE:
# First compile with
# First compile in aristotel with
# $> module load gcc/9.2.0 openmpi/4.0.3
# $> make -j hpc-build
#



+ 3
- 3
homework_2/include/distsort.hpp Ver arquivo

@@ -12,7 +12,7 @@

#include <vector>
#include <algorithm>
//#include <parallel/algorithm>
#include <parallel/algorithm>
#include <cmath>
#include <cstdint>
#if !defined DEBUG
@@ -162,10 +162,10 @@ template<typename RangeT>
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<>());
}
}



+ 5
- 24
homework_2/include/utils.hpp Ver arquivo

@@ -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 <typename Ret, typename Func, typename... Args>
//auto timeCall_r(Ret& ret, Func&& func, Args&&... args) {
// Timing timer;
//
// timer.start();
// ret = std::invoke(std::forward<Func>(func), std::forward<Args>(args)...);
// timer.stop();
//
// return timer.dt();
//}
Tim.start(); \
Func(__VA_ARGS__); \
Tim.stop(); \


#endif /* UTILS_HPP_ */

Carregando…
Cancelar
Salvar