From 6071a3608bc4e89dcf153564c6c15f0193bbcd6d Mon Sep 17 00:00:00 2001 From: augustin64 Date: Sun, 19 Feb 2023 15:08:02 +0100 Subject: [PATCH] Improve consistency across headers --- src/cnn/include/make.h | 18 ++++++++-------- src/include/memory_management.h | 38 +++++++++++++++++++++++++++------ src/include/utils.h | 6 +++--- 3 files changed, 43 insertions(+), 19 deletions(-) diff --git a/src/cnn/include/make.h b/src/cnn/include/make.h index af0f9ac..ea92d0d 100644 --- a/src/cnn/include/make.h +++ b/src/cnn/include/make.h @@ -13,36 +13,36 @@ void make_convolution_cpu(Kernel_cnn* kernel, float*** input, float*** output, i */ void make_convolution(Kernel_cnn* kernel, float*** input, float*** output, int output_dim); +#ifdef __CUDACC__ +extern "C" +#endif /* * Effectue un average pooling avec stride=size */ +void make_average_pooling(float*** input, float*** output, int size, int output_depth, int output_dim); + #ifdef __CUDACC__ extern "C" #endif -void make_average_pooling(float*** input, float*** output, int size, int output_depth, int output_dim); - /* * Effectue un max pooling avec stride=size */ +void make_max_pooling(float*** input, float*** output, int size, int output_depth, int output_dim); + #ifdef __CUDACC__ extern "C" #endif -void make_max_pooling(float*** input, float*** output, int size, int output_depth, int output_dim); - /* * Effectue une full connection */ +void make_dense(Kernel_nn* kernel, float* input, float* output, int size_input, int size_output); + #ifdef __CUDACC__ extern "C" #endif -void make_dense(Kernel_nn* kernel, float* input, float* output, int size_input, int size_output); - /* * Effectue une full connection qui passe d'une matrice à un vecteur */ -#ifdef __CUDACC__ -extern "C" -#endif void make_dense_linearised(Kernel_nn* kernel, float*** input, float* output, int depth_input, int dim_input, int size_output); #endif \ No newline at end of file diff --git a/src/include/memory_management.h b/src/include/memory_management.h index 7023d06..70b13c6 100644 --- a/src/include/memory_management.h +++ b/src/include/memory_management.h @@ -18,41 +18,65 @@ typedef struct Memory { struct Memory* next; // Élément suivant } Memory; -// Renvoie le nombre d'allocations totales dans la mémoire + +/* Get memory stats for tests */ #ifdef __CUDACC__ extern "C" #endif +/* +* Renvoie le nombre d'allocations totales dans la mémoire +*/ int get_memory_distinct_allocations(); -// Fonction récursive correspondante +/* +* Fonction récursive correspondante +*/ int get_distinct_allocations(Memory* mem); -// Renvoie le nombre d'éléments dans la liste chaînée représentant la mémoire #ifdef __CUDACC__ extern "C" #endif +/* +* Renvoie le nombre d'éléments dans la liste chaînée représentant la mémoire +*/ int get_memory_blocks_number(); -// Renvoie la taille d'une liste chaînée +/* +* Renvoie la taille d'une liste chaînée +*/ int get_length(Memory* mem); -// Créer un bloc de mémoire de taille size + + +/* +* Créer un bloc de mémoire de taille size +*/ Memory* create_memory_block(size_t size); -// Allouer un élément de taille size dans mem +/* +* Allouer un élément de taille size dans mem +*/ void* allocate_memory(size_t size, Memory* mem); -// Essayer de libérer le pointeur représenté par ptr dans mem +/* +* Essayer de libérer le pointeur représenté par ptr dans mem +*/ Memory* free_memory(void* ptr, Memory* mem); #ifdef __CUDACC__ extern "C" #endif +/* +* Alloue de la mémoire partagée CUDA si CUDA est activé +*/ void* nalloc(size_t sz); #ifdef __CUDACC__ extern "C" #endif +/* +* Libérer le mémoire allouée avec nalloc +*/ void gree(void* ptr); #endif \ No newline at end of file diff --git a/src/include/utils.h b/src/include/utils.h index 646a2db..5893308 100644 --- a/src/include/utils.h +++ b/src/include/utils.h @@ -30,12 +30,12 @@ inline void gpuAssert(cudaError_t code, const char *file, int line, bool abort=t */ int i_div_up(int a, int b); -/* -* Vérification de la compatibilité CUDA -*/ #ifdef __CUDACC__ extern "C" #endif +/* +* Vérification de la compatibilité CUDA +*/ bool check_cuda_compatibility(); #endif \ No newline at end of file