Add cnn-export-cuda

This commit is contained in:
augustin64 2023-05-27 22:23:50 +02:00
parent 771bfcaf70
commit 957c17a1df
2 changed files with 20 additions and 2 deletions

View File

@ -70,7 +70,7 @@ $(BUILDDIR)/dense_%.o: $(DENSE_SRCDIR)/%.c $(DENSE_SRCDIR)/include/%.h
#
# Build cnn
#
cnn: $(BUILDDIR)/cnn-main $(BUILDDIR)/cnn-main-cuda $(BUILDDIR)/cnn-preview $(BUILDDIR)/cnn-export;
cnn: $(BUILDDIR)/cnn-main $(BUILDDIR)/cnn-main-cuda $(BUILDDIR)/cnn-preview $(BUILDDIR)/cnn-export $(BUILDDIR)/cnn-export-cuda;
$(BUILDDIR)/cnn-main: $(CNN_SRCDIR)/main.c \
$(BUILDDIR)/cnn_backpropagation.o \
@ -147,6 +147,24 @@ $(BUILDDIR)/cnn-export: $(CNN_SRCDIR)/export.c \
$(CC) $^ -o $@ $(CFLAGS) $(LD_CFLAGS)
$(BUILDDIR)/cnn-export-cuda: $(CNN_SRCDIR)/export.c \
$(BUILDDIR)/cnn_cuda_backpropagation.o \
$(BUILDDIR)/cnn_cuda_convolution.o \
$(BUILDDIR)/cnn_neuron_io.cuda.o \
$(BUILDDIR)/cnn_cuda_function.o \
$(BUILDDIR)/cnn_free.cuda.o \
$(BUILDDIR)/cnn_cuda_make.o \
$(BUILDDIR)/cnn_cnn.cuda.o \
$(BUILDDIR)/cnn_utils.cuda.o \
$(BUILDDIR)/cnn_jpeg.cuda.o \
\
$(BUILDDIR)/cuda_memory_management.o \
$(BUILDDIR)/colors.cuda.o \
$(BUILDDIR)/mnist.o \
$(BUILDDIR)/cuda_utils.o
$(NVCC) $^ -o $@ $(NVCCFLAGS) $(LD_NVCCFLAGS)
$(BUILDDIR)/cnn_%.o: $(CNN_SRCDIR)/%.c $(CNN_SRCDIR)/include/%.h
$(CC) -c $< -o $@ $(CFLAGS)

View File

@ -82,7 +82,7 @@ void print_poids_ker_cnn(char* modele) {
void write_image(float** data, int width, int height, char* base_filename, int layer_id, int kernel_id) {
int filename_length = strlen(base_filename) + (int)log10(layer_id+1)+1 + (int)log10(kernel_id+1)+1 + 21;
int filename_length = strlen(base_filename) + (int)log10(layer_id+1)+1 + (int)log10(kernel_id+1)+1 + 21 +1;
char* filename = (char*)malloc(sizeof(char)*filename_length);
sprintf(filename, "%s_layer-%d_feature-%d.jpeg", base_filename, layer_id, kernel_id);