A measurement ready version

This commit is contained in:
2020-12-04 19:12:13 +02:00
parent fd8a3a2bc3
commit 8b5112dc2a
28 changed files with 10166 additions and 112 deletions
+1
View File
@@ -13,6 +13,7 @@
#include <v12.h>
#include <v3.h>
#include <v4.h>
#include <elearn.h>
/*
* Defines for different version of the exercise
+17
View File
@@ -0,0 +1,17 @@
/*!
* \file elearn.h
* \brief e-learning version of the exercise.
*
* \author
* Christos Choutouridis AEM:8997
* <cchoutou@ece.auth.gr>
*/
#ifndef ELEARN_H_
#define ELEARN_H_
#include <impl.hpp>
uint32_t elearn_test (void) ;
#endif /* ELEARN_H_ */
+26 -6
View File
@@ -284,8 +284,22 @@ struct SpMat {
* @return The value of the item or DataType{} if is not present.
*/
DataType get(IndexType i, IndexType j) {
IndexType end, idx =find_idx(rows, col_ptr[j], end=col_ptr[j+1], i);
return (idx != end) ? values[idx] : 0;
IndexType idx; bool found;
std::tie(idx, found) =find_idx(rows, col_ptr[j], col_ptr[j+1], i);
return (found) ? values[idx] : 0;
}
/*!
* A read item functionality using binary search to find the correct row
*
* @param i The row number
* @param j The column number
* @return The value of the item or DataType{} if is not present.
*/
DataType get2(IndexType i, IndexType j) {
IndexType idx; bool found;
std::tie(idx, found) =find2_idx(rows, col_ptr[j], col_ptr[j+1], i);
return (found) ? values[idx] : 0;
}
/*!
@@ -380,18 +394,18 @@ private:
* \param match What to search
* @return The index of the item or end on failure.
*/
IndexType find_idx(const std::vector<IndexType>& v, IndexType begin, IndexType end, IndexType match) {
std::pair<IndexType, bool> find_idx(const std::vector<IndexType>& v, IndexType begin, IndexType end, IndexType match) {
IndexType b = begin, e = end-1;
while (true) {
IndexType m = (b+e)/2;
if (v[m] == match) return m;
else if (b >= e) return end;
if (v[m] == match) return std::make_pair(m, true);
else if (b >= e) return std::make_pair(end, false);
else {
if (v[m] < match) b = m +1;
else e = m -1;
}
}
return end;
return std::make_pair(end, false);;
}
/*!
* find helper for set using index for begin-end instead of iterators.
@@ -687,13 +701,19 @@ struct session_t {
OutputMode outputMode {OutputMode::STD}; //!< Type of the output file
std::ofstream outFile {}; //!< File to use for output
std::size_t max_threads {}; //!< Maximum threads to use
std::size_t repeat {1}; //!< How many times we execute the calculations part
bool timing {false}; //!< Enable timing prints of the program
bool verbose {false}; //!< Flag to enable verbose output to stdout
#if CODE_VERSION == 3
bool makeSymmetric {false}; //!< symmetric matrix creation flag (true by default)
#else
bool makeSymmetric {true}; //!< symmetric matrix creation flag (true by default)
#endif
bool validate_mtx {false}; //!< Flag to request mtx input data triangular validation.
bool print_count {false}; //!< Flag to request total count printing
bool mtx_print {false}; //!< matrix print flag
std::size_t mtx_print_size {}; //!< matrix print size
bool dynamic {false}; //!< Selects dynamic scheduling for OpenMP and pthreads.
};
extern session_t session;
+1
View File
@@ -11,6 +11,7 @@
#include <iostream>
#include <mutex>
#include <atomic>
#include <impl.hpp>
#if defined CILK
+2
View File
@@ -24,6 +24,8 @@
#elif defined THREADS
#include <thread>
#include <numeric>
#include <random>
#else
#endif