diff --git a/Makefile b/Makefile index c904d8b..c59348a 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/src/cnn/export.c b/src/cnn/export.c index d304ab1..f571125 100644 --- a/src/cnn/export.c +++ b/src/cnn/export.c @@ -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);