mirror of
https://github.com/augustin64/projet-tipe
synced 2025-02-02 19:39:39 +01:00
Simplify extern "C"
expressions
This commit is contained in:
parent
20508558ba
commit
a9262cacc1
14
Makefile
14
Makefile
@ -96,19 +96,19 @@ 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.o \
|
||||
$(BUILDDIR)/cnn_cnn.cuda.o \
|
||||
$(BUILDDIR)/cnn_creation.cuda.o \
|
||||
$(BUILDDIR)/cnn_initialisation.o \
|
||||
$(BUILDDIR)/cnn_make.o \
|
||||
$(BUILDDIR)/cnn_initialisation.cuda.o \
|
||||
$(BUILDDIR)/cnn_cuda_make.o \
|
||||
$(BUILDDIR)/cnn_neuron_io.cuda.o \
|
||||
$(BUILDDIR)/cnn_function.o \
|
||||
$(BUILDDIR)/cnn_function.cuda.o \
|
||||
$(BUILDDIR)/cnn_utils.cuda.o \
|
||||
$(BUILDDIR)/cnn_update.o \
|
||||
$(BUILDDIR)/cnn_update.cuda.o \
|
||||
$(BUILDDIR)/cnn_free.cuda.o \
|
||||
$(BUILDDIR)/cnn_jpeg.cuda.o \
|
||||
$(BUILDDIR)/cnn_cuda_convolution.o \
|
||||
$(BUILDDIR)/cnn_backpropagation.o \
|
||||
$(BUILDDIR)/colors.o \
|
||||
$(BUILDDIR)/cnn_backpropagation.cuda.o \
|
||||
$(BUILDDIR)/colors.cuda.o \
|
||||
$(BUILDDIR)/mnist.cuda.o \
|
||||
$(BUILDDIR)/cuda_utils.o
|
||||
$(NVCC) $(LD_NVCCFLAGS) $(NVCCFLAGS) $^ -o $@
|
||||
|
@ -70,14 +70,11 @@ void make_convolution_device(Kernel_cnn* kernel, float*** input, float*** output
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" {
|
||||
|
||||
extern "C"
|
||||
void make_convolution(Kernel_cnn* kernel, float*** input, float*** output, int output_dim) {
|
||||
#ifndef __CUDACC__
|
||||
make_convolution_cpu(kernel, input, output, output_dim);
|
||||
#else
|
||||
make_convolution_device(kernel, input, output, output_dim);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
@ -34,27 +34,18 @@ int i_div_up(int a, int b);
|
||||
* Vérification de la compatibilité CUDA
|
||||
*/
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
bool check_cuda_compatibility();
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void* nalloc(size_t sz);
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void gree(void* ptr);
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
25
src/utils.c
25
src/utils.c
@ -15,7 +15,7 @@ int i_div_up(int a, int b) { // Partie entière supérieure de a/b
|
||||
}
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
bool check_cuda_compatibility() {
|
||||
#ifdef __CUDACC__
|
||||
@ -43,52 +43,37 @@ bool check_cuda_compatibility() {
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef USE_CUDA
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void* nalloc(size_t sz) {
|
||||
void* ptr = malloc(sz);
|
||||
return ptr;
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void gree(void* ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void* nalloc(size_t sz) {
|
||||
void* ptr;
|
||||
cudaMallocManaged(&ptr, sz, cudaMemAttachHost);
|
||||
return ptr;
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void gree(void* ptr) {
|
||||
cudaFree(ptr);
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
25
src/utils.cu
25
src/utils.cu
@ -15,7 +15,7 @@ int i_div_up(int a, int b) { // Partie entière supérieure de a/b
|
||||
}
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
bool check_cuda_compatibility() {
|
||||
#ifdef __CUDACC__
|
||||
@ -43,52 +43,37 @@ bool check_cuda_compatibility() {
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef USE_CUDA
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void* nalloc(size_t sz) {
|
||||
void* ptr = malloc(sz);
|
||||
return ptr;
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void gree(void* ptr) {
|
||||
free(ptr);
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
#else
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void* nalloc(size_t sz) {
|
||||
void* ptr;
|
||||
cudaMallocManaged(&ptr, sz, cudaMemAttachHost);
|
||||
return ptr;
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef __CUDACC__
|
||||
extern "C" {
|
||||
extern "C"
|
||||
#endif
|
||||
void gree(void* ptr) {
|
||||
cudaFree(ptr);
|
||||
}
|
||||
#ifdef __CUDACC__
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user