Add files via upload

This commit is contained in:
David Rotermund 2023-02-06 09:57:04 +01:00 committed by GitHub
parent 4a47c78c48
commit 6477fb29e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,11 +3,12 @@
#include <omp.h> #include <omp.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <chrono>
#include <algorithm> #include <algorithm>
#include <cassert> #include <cassert>
#include <iostream> #include <iostream>
// #define DEBUGSHOWTIMEGLOBAL
HDynamicCNNCPU::HDynamicCNNCPU() HDynamicCNNCPU::HDynamicCNNCPU()
{ {
@ -113,6 +114,11 @@ void HDynamicCNNCPU::entrypoint(
assert((number_of_processes > 0)); assert((number_of_processes > 0));
omp_set_num_threads(number_of_processes); omp_set_num_threads(number_of_processes);
#ifdef DEBUGSHOWTIMEGLOBAL
using TIME_resolution = std::chrono::nanoseconds;
auto TIME_start = std::chrono::high_resolution_clock::now();
#endif
#pragma omp parallel for #pragma omp parallel for
for (size_t pattern_id = 0; pattern_id < number_of_pattern; pattern_id++) for (size_t pattern_id = 0; pattern_id < number_of_pattern; pattern_id++)
{ {
@ -141,6 +147,12 @@ void HDynamicCNNCPU::entrypoint(
pattern_id); pattern_id);
} }
#ifdef DEBUGSHOWTIMEGLOBAL
auto TIME_end = std::chrono::high_resolution_clock::now();
float TIME_measured = TIME_resolution(TIME_end - TIME_start).count();
std::cout << "Time used : " << TIME_measured/(1000.0*1000.0) << "ms" << std::endl;
#endif
return; return;
}; };
@ -259,8 +271,10 @@ void HDynamicCNNCPU::update_one_ip(
spike = input_pointer + counter_spike * input_dim_c1; spike = input_pointer + counter_spike * input_dim_c1;
if (*spike >= 0) if (*spike < 0)
{ {
break;
}
if (epsilon_xy_dim_c0 != 0) if (epsilon_xy_dim_c0 != 0)
{ {
epsilon_subsegment = epsilon_subsegment =
@ -320,12 +334,12 @@ void HDynamicCNNCPU::update_one_ip(
} }
else else
{ {
epsilon_scale *= 1.0 + epsilon_subsegment * 1.0; epsilon_scale *= 1.0 + epsilon_subsegment;
}
} }
} }
} }
temp_value = 1.0 / epsilon_scale; temp_value = 1.0 / epsilon_scale;
#pragma omp simd #pragma omp simd
for (size_t counter = 0; counter < h_dim; counter++) for (size_t counter = 0; counter < h_dim; counter++)