mirror of
https://github.com/augustin64/projet-tipe
synced 2025-01-23 15:16:26 +01:00
Fixes for cuda compilation following 3b9ad3d
This commit is contained in:
parent
f60fe9ca69
commit
a7df405d08
@ -115,9 +115,9 @@ __global__ void backward_average_pooling_kernel(float*** input, float*** output,
|
||||
int max_move = kernel_size - padding;
|
||||
|
||||
for (int a=-padding; a < max_move; a++) {
|
||||
for (int b=-paddding; b < max_move; b++) {
|
||||
for (int b=-padding; b < max_move; b++) {
|
||||
int idy_2 = stride*idy +a;
|
||||
int idz_2 = stride*idz +b:
|
||||
int idz_2 = stride*idz +b;
|
||||
if (not_outside(idy_2, idz_2, 0, input_width)) {
|
||||
int y = min(idy_2+1, min(kernel_size, input_width - idy_2));
|
||||
int z = min(idz_2+1, min(kernel_size, input_width - idz_2));
|
||||
@ -214,7 +214,7 @@ __global__ void backward_max_pooling_kernel(float*** input, float*** output, int
|
||||
}
|
||||
}
|
||||
if (cpt==0) {
|
||||
printf_error("Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
printf(RED "[ERROR]" RESET " Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
}
|
||||
input[idx][stride*idy +a_max][stride*idz +b_max] = output[idx][idy][idz]/cpt;
|
||||
}
|
||||
@ -262,7 +262,7 @@ void backward_max_pooling_cpu(float*** input, float*** output, int input_width,
|
||||
}
|
||||
}
|
||||
if (cpt==0) {
|
||||
printf_error("Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
printf_error((char*)"Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
}
|
||||
else {
|
||||
input[i][stride*j +a_max][stride*k +b_max] = output[i][j][k]/cpt;
|
||||
|
@ -115,9 +115,9 @@ __global__ void backward_average_pooling_kernel(float*** input, float*** output,
|
||||
int max_move = kernel_size - padding;
|
||||
|
||||
for (int a=-padding; a < max_move; a++) {
|
||||
for (int b=-paddding; b < max_move; b++) {
|
||||
for (int b=-padding; b < max_move; b++) {
|
||||
int idy_2 = stride*idy +a;
|
||||
int idz_2 = stride*idz +b:
|
||||
int idz_2 = stride*idz +b;
|
||||
if (not_outside(idy_2, idz_2, 0, input_width)) {
|
||||
int y = min(idy_2+1, min(kernel_size, input_width - idy_2));
|
||||
int z = min(idz_2+1, min(kernel_size, input_width - idz_2));
|
||||
@ -214,7 +214,7 @@ __global__ void backward_max_pooling_kernel(float*** input, float*** output, int
|
||||
}
|
||||
}
|
||||
if (cpt==0) {
|
||||
printf_error("Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
printf(RED "[ERROR]" RESET " Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
}
|
||||
input[idx][stride*idy +a_max][stride*idz +b_max] = output[idx][idy][idz]/cpt;
|
||||
}
|
||||
@ -262,7 +262,7 @@ void backward_max_pooling_cpu(float*** input, float*** output, int input_width,
|
||||
}
|
||||
}
|
||||
if (cpt==0) {
|
||||
printf_error("Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
printf_error((char*)"Dimensions ou stride ou padding erroné dans 'backward_max_pooling_cpu'\n");
|
||||
}
|
||||
else {
|
||||
input[i][stride*j +a_max][stride*k +b_max] = output[i][j][k]/cpt;
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#include "include/config.h"
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
|
||||
void make_convolution_cpu(Kernel_cnn* kernel, float*** input, float*** output, int output_width, int stride, int padding) {
|
||||
// c'est le kernel de input
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#include "include/config.h"
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
|
||||
void make_convolution_cpu(Kernel_cnn* kernel, float*** input, float*** output, int output_width, int stride, int padding) {
|
||||
// c'est le kernel de input
|
||||
|
@ -1,8 +1,5 @@
|
||||
#include "struct.h"
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Effectue la convolution naïvement sur le processeur
|
||||
|
@ -3,9 +3,6 @@
|
||||
#ifndef DEF_MAKE_H
|
||||
#define DEF_MAKE_H
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Effectue la propagation d'une convolution avec stride et padding choisis sur le processeur
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
#include "include/config.h"
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Average Pooling
|
||||
|
@ -10,9 +10,6 @@
|
||||
|
||||
#include "include/config.h"
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Average Pooling
|
||||
|
@ -39,6 +39,9 @@ int max(int a, int b);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
/*
|
||||
* On renvoie true si et seulement si _ et _:
|
||||
* lower_bound <= x < upper_bound
|
||||
|
@ -26,6 +26,10 @@ int max(int a, int b) {
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
int not_outside(int x, int y, int lower_bound, int upper_bound) {
|
||||
return !(x < lower_bound || y < lower_bound || x >= upper_bound || y>= upper_bound);
|
||||
}
|
||||
|
@ -27,6 +27,13 @@ int max(int a, int b) {
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __CUDACC__
|
||||
__host__ __device__
|
||||
#endif
|
||||
int not_outside(int x, int y, int lower_bound, int upper_bound) {
|
||||
return !(x < lower_bound || y < lower_bound || x >= upper_bound || y>= upper_bound);
|
||||
}
|
||||
|
||||
int i_div_up(int a, int b) { // Partie entière supérieure de a/b
|
||||
return ((a % b) != 0) ? (a / b + 1) : (a / b);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user