Commit a0418cc8 by FritzFlorian

Fix compiler warnings.

parent 5978c910
Pipeline #1590 passed with stages
in 4 minutes 46 seconds
...@@ -45,9 +45,9 @@ int main(int argc, char **argv) { ...@@ -45,9 +45,9 @@ int main(int argc, char **argv) {
fft::complex_vector fft_data(fft_size); fft::complex_vector fft_data(fft_size);
fft::complex_vector fft_swap_array(fft_size); fft::complex_vector fft_swap_array(fft_size);
fft::fill_input(fft_data); fft::fill_input(fft_data);
matrix::matrix<double> matrix_a{settings.size_}; matrix::matrix<double> matrix_a{matrix_size};
matrix::matrix<double> matrix_b{settings.size_}; matrix::matrix<double> matrix_b{matrix_size};
matrix::matrix<double> matrix_result{settings.size_}; matrix::matrix<double> matrix_result{matrix_size};
if (settings.type_ == benchmark_runner::benchmark_settings::ISOLATED) { if (settings.type_ == benchmark_runner::benchmark_settings::ISOLATED) {
#if PLS_PROFILING_ENABLED #if PLS_PROFILING_ENABLED
......
...@@ -27,6 +27,7 @@ void custom_stack_callback(void *); ...@@ -27,6 +27,7 @@ void custom_stack_callback(void *);
void __attribute__ ((noinline)) callback() { void __attribute__ ((noinline)) callback() {
static volatile int tmp; static volatile int tmp;
tmp = 0; // Force at least a single memory write tmp = 0; // Force at least a single memory write
(void) tmp;
} }
} }
...@@ -35,6 +36,7 @@ long measure_loop() { ...@@ -35,6 +36,7 @@ long measure_loop() {
volatile int tmp; volatile int tmp;
for (unsigned int i = 0; i < NUM_RUNS; i++) { for (unsigned int i = 0; i < NUM_RUNS; i++) {
tmp = 0; tmp = 0;
(void) tmp;
} }
auto end_time = chrono::steady_clock::now(); auto end_time = chrono::steady_clock::now();
return chrono::duration_cast<chrono::nanoseconds>(end_time - start_time).count(); return chrono::duration_cast<chrono::nanoseconds>(end_time - start_time).count();
......
...@@ -29,36 +29,36 @@ class matrix { ...@@ -29,36 +29,36 @@ class matrix {
} }
explicit matrix(size_t size) : size_{size}, data_(size * size) { explicit matrix(size_t size) : size_{size}, data_(size * size) {
for (int i = 0; i < size_; i++) { for (size_t i = 0; i < size_; i++) {
for (int j = 0; j < size_; j++) { for (size_t j = 0; j < size_; j++) {
data_at(i, j) = i; data_at(i, j) = i;
} }
} }
} }
virtual void multiply(const matrix<T> &a, const matrix<T> &b) { virtual void multiply(const matrix<T> &a, const matrix<T> &b) {
for (int i = 0; i < size_; i++) { for (size_t i = 0; i < size_; i++) {
multiply_column(i, a, b); multiply_column(i, a, b);
} }
} }
protected: protected:
void multiply_column(int i, const matrix<T> &a, const matrix<T> &b) { void multiply_column(int i, const matrix<T> &a, const matrix<T> &b) {
for (int j = 0; j < size_; ++j) { for (size_t j = 0; j < size_; ++j) {
data_at(i, j) = 0; data_at(i, j) = 0;
} }
for (int k = 0; k < size_; ++k) { for (size_t k = 0; k < size_; ++k) {
for (int j = 0; j < size_; ++j) { for (size_t j = 0; j < size_; ++j) {
data_at(i, j) += a.data_at(i, k) * b.data_at(i, k); data_at(i, j) += a.data_at(i, k) * b.data_at(i, k);
} }
} }
} }
}; };
template<typename T, int SIZE> template<typename T>
std::ostream &operator<<(std::ostream &strm, const matrix<T> &matrix) { std::ostream &operator<<(std::ostream &strm, const matrix<T> &matrix) {
for (int i = 0; i < SIZE; i++) { for (size_t i = 0; i < matrix.size_; i++) {
for (int j = 0; j < SIZE; j++) { for (size_t j = 0; j < matrix.size_; j++) {
strm << matrix.data_at(i, j) << "\t"; strm << matrix.data_at(i, j) << "\t";
} }
strm << std::endl; strm << std::endl;
......
...@@ -13,10 +13,10 @@ template<typename RandomIt, typename Function> ...@@ -13,10 +13,10 @@ template<typename RandomIt, typename Function>
static void for_each_iterator(const RandomIt first, static void for_each_iterator(const RandomIt first,
const RandomIt last, const RandomIt last,
const Function &function, const Function &function,
const size_t min_elements) { const long min_elements) {
using namespace ::pls::internal::scheduling; using namespace ::pls::internal::scheduling;
const long num_elements = std::distance(first, last); const auto num_elements = std::distance(first, last);
if (num_elements <= min_elements) { if (num_elements <= min_elements) {
// calculate last elements in loop to avoid overhead // calculate last elements in loop to avoid overhead
for (auto current = first; current != last; current++) { for (auto current = first; current != last; current++) {
...@@ -45,10 +45,10 @@ template<typename Function> ...@@ -45,10 +45,10 @@ template<typename Function>
static void for_each_range(const long first, static void for_each_range(const long first,
const long last, const long last,
const Function &function, const Function &function,
const size_t min_elements) { const long min_elements) {
using namespace ::pls::internal::scheduling; using namespace ::pls::internal::scheduling;
const long num_elements = last - first; const auto num_elements = last - first;
if (num_elements <= min_elements) { if (num_elements <= min_elements) {
// calculate last elements in loop to avoid overhead // calculate last elements in loop to avoid overhead
for (auto current = first; current != last; current++) { for (auto current = first; current != last; current++) {
......
...@@ -22,18 +22,18 @@ using internal::scheduling::scheduler; ...@@ -22,18 +22,18 @@ using internal::scheduling::scheduler;
using internal::base::heap_stack_allocator; using internal::base::heap_stack_allocator;
using internal::base::mmap_stack_allocator; using internal::base::mmap_stack_allocator;
template<typename Function> template<typename Function>
static void spawn(Function &&function) { inline void spawn(Function &&function) {
scheduler::spawn(std::forward<Function>(function)); scheduler::spawn(std::forward<Function>(function));
} }
template<typename Function> template<typename Function>
static void spawn_and_sync(Function &&function) { inline void spawn_and_sync(Function &&function) {
scheduler::spawn_and_sync(std::forward<Function>(function)); scheduler::spawn_and_sync(std::forward<Function>(function));
} }
static void sync() { inline void sync() {
scheduler::sync(); scheduler::sync();
} }
template<typename Function> template<typename Function>
static void serial(Function &&function) { inline void serial(Function &&function) {
scheduler::serial(std::forward<Function>(function)); scheduler::serial(std::forward<Function>(function));
} }
......
...@@ -100,9 +100,9 @@ TEST_CASE("external trading deque", "[internal/scheduling/lock_free/external_tra ...@@ -100,9 +100,9 @@ TEST_CASE("external trading deque", "[internal/scheduling/lock_free/external_tra
scheduler.task_manager_for(1).get_task(3)}; scheduler.task_manager_for(1).get_task(3)};
auto &thread_state_1 = scheduler.thread_state_for(0); auto &thread_state_1 = scheduler.thread_state_for(0);
auto &task_manager_1 = scheduler.thread_state_for(0).get_task_manager(); auto &task_manager_1 = thread_state_1.get_task_manager();
auto &thread_state_2 = scheduler.thread_state_for(1); auto &thread_state_2 = scheduler.thread_state_for(1);
auto &task_manager_2 = scheduler.thread_state_for(1).get_task_manager(); auto &task_manager_2 = thread_state_2.get_task_manager();
SECTION("Must start empty") { SECTION("Must start empty") {
REQUIRE(!task_manager_1.pop_local_task()); REQUIRE(!task_manager_1.pop_local_task());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment