diff --git a/src/mnist/cuda_utils.cu b/src/mnist/cuda_utils.cu index 42684d1..0888684 100644 --- a/src/mnist/cuda_utils.cu +++ b/src/mnist/cuda_utils.cu @@ -1,9 +1,7 @@ #include #include -#include "mnist.c" - -#include "include/cuda_utils.h" +#include "include/mnist.h" diff --git a/src/mnist/include/cuda_utils.h b/src/mnist/include/cuda_utils.h index 6354085..65c4217 100644 --- a/src/mnist/include/cuda_utils.h +++ b/src/mnist/include/cuda_utils.h @@ -3,6 +3,8 @@ #ifndef DEF_CUDA_UTILS_H #define DEF_CUDA_UTILS_H + +#include "../cuda_utils.cu" /* * Il est entendu par "device" le GPU supportant CUDA utilisé */ diff --git a/src/mnist/include/main.h b/src/mnist/include/main.h index d8a6105..8d2f99c 100644 --- a/src/mnist/include/main.h +++ b/src/mnist/include/main.h @@ -1,19 +1,7 @@ #ifndef DEF_MAIN_H #define DEF_MAIN_H -/* -* Structure donnée en argument à la fonction 'train_images' -*/ -typedef struct TrainParameters { - Network* network; - int*** images; - int* labels; - int start; - int nb_images; - int height; - int width; - float accuracy; -} TrainParameters; +#include "../main.c" /* * Affiche une image ainsi que les prévisions faites par le réseau de neurones sur sa valeur diff --git a/src/mnist/include/mnist.h b/src/mnist/include/mnist.h index 15214fd..9b56104 100644 --- a/src/mnist/include/mnist.h +++ b/src/mnist/include/mnist.h @@ -6,6 +6,8 @@ #ifndef DEF_MNIST_H #define DEF_MNIST_H +#include "../mnist.c" + uint32_t swap_endian(uint32_t val); /* diff --git a/src/mnist/include/neural_network.h b/src/mnist/include/neural_network.h index b47deac..af183e2 100644 --- a/src/mnist/include/neural_network.h +++ b/src/mnist/include/neural_network.h @@ -10,6 +10,8 @@ #ifndef DEF_NEURAL_NETWORK_H #define DEF_NEURAL_NETWORK_H +#include "../neural_network.c" + /* * Fonction max pour les floats */ diff --git a/src/mnist/include/neuron_io.h b/src/mnist/include/neuron_io.h index 780af3f..2d7c1b1 100644 --- a/src/mnist/include/neuron_io.h +++ b/src/mnist/include/neuron_io.h @@ -8,7 +8,7 @@ #ifndef DEF_NEURON_IO_H #define DEF_NEURON_IO_H - +#include "../neuron_io.c" // Lecture d'un réseau neuronal diff --git a/src/mnist/include/preview.h b/src/mnist/include/preview.h index b8d9ccd..6156699 100644 --- a/src/mnist/include/preview.h +++ b/src/mnist/include/preview.h @@ -6,6 +6,8 @@ #ifndef DEF_PREVIEW_H #define DEF_PREVIEW_H +#include "../preview.c" + /* * Affiche un chiffre de taille width x height */ diff --git a/src/mnist/main.c b/src/mnist/main.c index 93070a3..faf71cc 100644 --- a/src/mnist/main.c +++ b/src/mnist/main.c @@ -6,11 +6,9 @@ #include #include -#include "mnist.c" -#include "neuron_io.c" -#include "neural_network.c" - -#include "include/main.h" +#include "include/mnist.h" +#include "include/neuron_io.h" +#include "include/neural_network.h" #define EPOCHS 10 #define BATCHES 100 @@ -21,6 +19,20 @@ # define MAX_CUDA_THREADS 1024 // from NVIDIA documentation #endif +/* +* Structure donnée en argument à la fonction 'train_images' +*/ +typedef struct TrainParameters { + Network* network; + int*** images; + int* labels; + int start; + int nb_images; + int height; + int width; + float accuracy; +} TrainParameters; + void print_image(unsigned int width, unsigned int height, int** image, float* previsions) { char tab[] = {' ', '.', ':', '%', '#', '\0'}; diff --git a/src/mnist/mnist.c b/src/mnist/mnist.c index 597e30b..8169a6c 100644 --- a/src/mnist/mnist.c +++ b/src/mnist/mnist.c @@ -3,8 +3,6 @@ #include #include -#include "include/mnist.h" - uint32_t swap_endian(uint32_t val) { val = ((val << 8) & 0xFF00FF00) | ((val >> 8) & 0xFF00FF); return (val << 16) | (val >> 16); diff --git a/src/mnist/neural_network.c b/src/mnist/neural_network.c index 5cf2ae5..638673d 100644 --- a/src/mnist/neural_network.c +++ b/src/mnist/neural_network.c @@ -7,7 +7,6 @@ #include #include "include/neuron.h" -#include "include/neural_network.h" // Définit le taux d'apprentissage du réseau neuronal, donc la rapidité d'adaptation du modèle (compris entre 0 et 1) // Cette valeur peut évoluer au fur et à mesure des époques (linéaire c'est mieux) diff --git a/src/mnist/neuron_io.c b/src/mnist/neuron_io.c index 30d93be..e49758a 100644 --- a/src/mnist/neuron_io.c +++ b/src/mnist/neuron_io.c @@ -4,7 +4,6 @@ #include #include "include/neuron.h" -#include "include/neuron_io.h" #define MAGIC_NUMBER 2023 #define DELTA_MAGIC_NUMBER 2024 diff --git a/src/mnist/preview.c b/src/mnist/preview.c index 058ab78..82e4e45 100644 --- a/src/mnist/preview.c +++ b/src/mnist/preview.c @@ -3,8 +3,7 @@ #include #include -#include "mnist.c" -#include "include/preview.h" +#include "include/mnist.h" void print_image(unsigned int width, unsigned int height, int** image) { diff --git a/src/mnist/utils.c b/src/mnist/utils.c index 1a8f2e1..8e61851 100644 --- a/src/mnist/utils.c +++ b/src/mnist/utils.c @@ -3,9 +3,9 @@ #include #include -#include "neural_network.c" -#include "neuron_io.c" -#include "mnist.c" +#include "include/neural_network.h" +#include "include/neuron_io.h" +#include "include/mnist.h" /* Contient un ensemble de fonctions utiles pour le débogage diff --git a/test/cuda_utils.cu b/test/cuda_utils.cu index 74f8709..c103814 100644 --- a/test/cuda_utils.cu +++ b/test/cuda_utils.cu @@ -1,7 +1,7 @@ #include #include -#include "../src/mnist/cuda_utils.cu" +#include "../src/mnist/include/cuda_utils.h" #define MAX_CUDA_THREADS 1024 #define gpuErrchk(ans) { gpuAssert((ans), __FILE__, __LINE__); } diff --git a/test/mnist_data_io.c b/test/mnist_data_io.c index a7d2ada..d413b63 100644 --- a/test/mnist_data_io.c +++ b/test/mnist_data_io.c @@ -2,7 +2,7 @@ #include #include -#include "../src/mnist/mnist.c" +#include "../src/mnist/include/mnist.h" void read_test(int nb_images, int width, int height, int*** images, unsigned int* labels) { diff --git a/test/mnist_neural_network.c b/test/mnist_neural_network.c index c0691fd..334e902 100644 --- a/test/mnist_neural_network.c +++ b/test/mnist_neural_network.c @@ -3,8 +3,8 @@ #include #include -#include "../src/mnist/neural_network.c" -#include "../src/mnist/neuron_io.c" +#include "../src/mnist/include/neural_network.h" +#include "../src/mnist/include/neuron_io.h" int main() { printf("Création du réseau\n"); diff --git a/test/mnist_neuron_io.c b/test/mnist_neuron_io.c index 5a86dcb..e93b95a 100644 --- a/test/mnist_neuron_io.c +++ b/test/mnist_neuron_io.c @@ -3,8 +3,8 @@ #include #include -#include "../src/mnist/neuron_io.c" -#include "../src/mnist/neural_network.c" +#include "../src/mnist/include/neuron_io.h" +#include "../src/mnist/include/neural_network.h" Neuron* creer_neuron(int nb_sortants) {