Update headers and Makefile to reflect 4910137

This commit is contained in:
augustin64 2023-05-15 18:25:29 +02:00
parent 491013713d
commit 9db15e96ac
5 changed files with 60 additions and 29 deletions

View File

@ -41,7 +41,12 @@ NVCCFLAGS = -g
# -fsanitize=address -lasan
#! WARNING: test/cnn-neuron_io fails with this option enabled
all: dense cnn;
#
# Build dense
#
@ -61,50 +66,57 @@ $(BUILDDIR)/dense_%.o: $(DENSE_SRCDIR)/%.c $(DENSE_SRCDIR)/include/%.h
$(CC) -c $< -o $@ $(CFLAGS)
#
# Build cnn
#
cnn: $(BUILDDIR)/cnn-main $(BUILDDIR)/cnn-main-cuda $(BUILDDIR)/cnn-preview $(BUILDDIR)/cnn-export;
$(BUILDDIR)/cnn-main: $(CNN_SRCDIR)/main.c \
$(BUILDDIR)/cnn_train.o \
$(BUILDDIR)/cnn_test_network.o \
$(BUILDDIR)/cnn_cnn.o \
$(BUILDDIR)/cnn_creation.o \
$(BUILDDIR)/cnn_backpropagation.o \
$(BUILDDIR)/cnn_initialisation.o \
$(BUILDDIR)/cnn_make.o \
$(BUILDDIR)/cnn_test_network.o \
$(BUILDDIR)/cnn_convolution.o \
$(BUILDDIR)/cnn_neuron_io.o \
$(BUILDDIR)/cnn_function.o \
$(BUILDDIR)/cnn_utils.o \
$(BUILDDIR)/cnn_creation.o \
$(BUILDDIR)/cnn_models.o \
$(BUILDDIR)/cnn_update.o \
$(BUILDDIR)/cnn_train.o \
$(BUILDDIR)/cnn_utils.o \
$(BUILDDIR)/cnn_make.o \
$(BUILDDIR)/cnn_free.o \
$(BUILDDIR)/cnn_jpeg.o \
$(BUILDDIR)/cnn_convolution.o \
$(BUILDDIR)/cnn_backpropagation.o \
$(BUILDDIR)/cnn_cnn.o \
\
$(BUILDDIR)/memory_management.o \
$(BUILDDIR)/colors.o \
$(BUILDDIR)/mnist.o \
$(BUILDDIR)/utils.o
$(CC) $^ -o $@ $(CFLAGS) $(LD_CFLAGS)
ifdef NVCC_INSTALLED
$(BUILDDIR)/cnn-main-cuda: $(BUILDDIR)/cnn_main.cuda.o \
$(BUILDDIR)/cnn_train.cuda.o \
$(BUILDDIR)/cnn_test_network.cuda.o \
$(BUILDDIR)/cnn_cnn.cuda.o \
$(BUILDDIR)/cnn_creation.cuda.o \
$(BUILDDIR)/cnn_initialisation.cuda.o \
$(BUILDDIR)/cnn_cuda_make.o \
$(BUILDDIR)/cnn_test_network.cuda.o \
$(BUILDDIR)/cnn_neuron_io.cuda.o \
$(BUILDDIR)/cnn_cuda_function.o \
$(BUILDDIR)/cnn_utils.cuda.o \
$(BUILDDIR)/cnn_creation.cuda.o \
$(BUILDDIR)/cnn_models.cuda.o \
$(BUILDDIR)/cnn_update.cuda.o \
$(BUILDDIR)/cnn_train.cuda.o \
$(BUILDDIR)/cnn_utils.cuda.o \
$(BUILDDIR)/cnn_free.cuda.o \
$(BUILDDIR)/cnn_jpeg.cuda.o \
$(BUILDDIR)/cnn_cuda_convolution.o \
$(BUILDDIR)/cnn_cnn.cuda.o \
\
$(BUILDDIR)/cnn_cuda_backpropagation.o \
$(BUILDDIR)/colors.cuda.o \
$(BUILDDIR)/cnn_cuda_convolution.o \
$(BUILDDIR)/cnn_cuda_function.o \
$(BUILDDIR)/cnn_cuda_make.o \
\
$(BUILDDIR)/cuda_memory_management.o \
$(BUILDDIR)/colors.cuda.o \
$(BUILDDIR)/mnist.cuda.o \
$(BUILDDIR)/cuda_utils.o
$(NVCC) $(LD_NVCCFLAGS) $(NVCCFLAGS) $^ -o $@
@ -113,30 +125,36 @@ $(BUILDDIR)/cnn-main-cuda:
@echo "$(NVCC) not found, skipping"
endif
$(BUILDDIR)/cnn-preview: $(CNN_SRCDIR)/preview.c $(BUILDDIR)/cnn_jpeg.o $(BUILDDIR)/colors.o $(BUILDDIR)/utils.o
$(CC) $^ -o $@ $(CFLAGS) $(LD_CFLAGS)
$(BUILDDIR)/cnn-export: $(CNN_SRCDIR)/export.c \
$(BUILDDIR)/cnn_free.o \
$(BUILDDIR)/cnn_neuron_io.o \
$(BUILDDIR)/utils.o \
$(BUILDDIR)/memory_management.o \
$(BUILDDIR)/cnn_cnn.o \
$(BUILDDIR)/cnn_make.o \
$(BUILDDIR)/cnn_backpropagation.o \
$(BUILDDIR)/cnn_function.o \
$(BUILDDIR)/cnn_convolution.o \
$(BUILDDIR)/cnn_neuron_io.o \
$(BUILDDIR)/cnn_function.o \
$(BUILDDIR)/cnn_free.o \
$(BUILDDIR)/cnn_make.o \
$(BUILDDIR)/cnn_cnn.o \
$(BUILDDIR)/cnn_jpeg.o \
\
$(BUILDDIR)/memory_management.o \
$(BUILDDIR)/colors.o \
$(BUILDDIR)/mnist.o \
$(BUILDDIR)/cnn_jpeg.o
$(BUILDDIR)/utils.o
$(CC) $^ -o $@ $(CFLAGS) $(LD_CFLAGS)
$(BUILDDIR)/cnn_%.o: $(CNN_SRCDIR)/%.c $(CNN_SRCDIR)/include/%.h
$(CC) -c $< -o $@ $(CFLAGS)
$(BUILDDIR)/cnn_%.cuda.o: $(CNN_SRCDIR)/%.c $(CNN_SRCDIR)/include/%.h
$(CC) -c $< -o $@ $(CFLAGS) -DUSE_CUDA -lcuda -I$(CUDA_INCLUDE)
ifdef NVCC_INSTALLED
$(BUILDDIR)/cnn_cuda_%.o: $(CNN_SRCDIR)/%.cu $(CNN_SRCDIR)/include/%.h
$(NVCC) $(NVCCFLAGS) -c -dc $< -o $@
@ -144,15 +162,20 @@ else
$(BUILDDIR)/cnn_cuda_%.o: $(CNN_SRCDIR)/%.cu $(CNN_SRCDIR)/include/%.h
@echo "$(NVCC) not found, skipping"
endif
#
# Build general files
#
$(BUILDDIR)/%.o: $(COMMON_SRCDIR)/%.c $(COMMON_SRCDIR)/include/%.h
$(CC) -c $< -o $@ $(CFLAGS)
$(BUILDDIR)/%.cuda.o: $(COMMON_SRCDIR)/%.c $(COMMON_SRCDIR)/include/%.h
$(CC) -c $< -o $@ $(CFLAGS) -DUSE_CUDA -lcuda -I$(CUDA_INCLUDE)
ifdef NVCC_INSTALLED
$(BUILDDIR)/cuda_%.o: $(COMMON_SRCDIR)/%.cu $(COMMON_SRCDIR)/include/%.h
$(NVCC) $(NVCCFLAGS) -c -dc $< -o $@
@ -160,6 +183,8 @@ else
@echo "$(NVCC) not found, skipping"
endif
#
# Tests
#
@ -207,6 +232,8 @@ $(BUILDDIR)/test-cnn_%: $(TEST_SRCDIR)/cnn_%.cu
@echo "$(NVCC) not found, skipping"
endif
#
# Utils
#
@ -231,6 +258,7 @@ $(CACHE_DIR)/mnist-reseau-cnn.bin: $(BUILDDIR)/cnn-main
--out $(CACHE_DIR)/mnist-reseau-cnn.bin
#
# Clean project
#

View File

@ -8,15 +8,15 @@
#include <omp.h>
#include "../common/include/memory_management.h"
#include "../common/include/colors.h"
#include "../common/include/utils.h"
#include "../common/include/mnist.h"
#include "include/initialisation.h"
#include "include/test_network.h"
#include "include/neuron_io.h"
#include "../common/include/colors.h"
#include "../common/include/utils.h"
#include "include/function.h"
#include "include/creation.h"
#include "include/update.h"
#include "include/models.h"
#include "include/utils.h"
#include "include/free.h"
#include "include/jpeg.h"

View File

@ -6,6 +6,7 @@
#include "../src/common/include/colors.h"
#include "../src/cnn/include/neuron_io.h"
#include "../src/cnn/include/creation.h"
#include "../src/cnn/include/models.h"
#include "../src/cnn/include/utils.h"
#include "../src/cnn/include/free.h"

View File

@ -5,6 +5,7 @@
#include "../src/common/include/colors.h"
#include "../src/cnn/include/creation.h"
#include "../src/cnn/include/models.h"
#include "../src/cnn/include/utils.h"
#include "../src/cnn/include/free.h"

View File

@ -3,6 +3,7 @@
#include "../src/common/include/colors.h"
#include "../src/cnn/include/creation.h"
#include "../src/cnn/include/models.h"
#include "../src/cnn/include/utils.h"
#include "../src/cnn/include/free.h"