Skip to content

Commit

Permalink
update extern 'C'
Browse files Browse the repository at this point in the history
  • Loading branch information
a-sevin committed Sep 27, 2020
1 parent 1fbbd66 commit 7c400da
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
10 changes: 5 additions & 5 deletions cudacomp_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ inline int testing_malloc_cpu_internal(void **ptr, size_t size, const char *var,
do { \
testing_malloc_cpu_internal((void **)&ptr, size * sizeof(type), #ptr, \
__FUNCTION__, __FILE__, __LINE__); \
} while (0);
} while (0)

#define TESTING_FREE_CPU(ptr) free(ptr)

Expand All @@ -45,7 +45,7 @@ inline int testing_malloc_pin_internal(void **ptr, size_t size, const char *var,
do { \
testing_malloc_pin_internal((void **)&ptr, size * sizeof(type), #ptr, \
__FUNCTION__, __FILE__, __LINE__); \
} while (0);
} while (0)

inline int testing_free_pin_internal(void *ptr, const char *var,
const char *func, const char *file,
Expand All @@ -61,7 +61,7 @@ inline int testing_free_pin_internal(void *ptr, const char *var,
#define TESTING_FREE_PIN(ptr) \
do { \
testing_free_pin_internal(ptr, #ptr, __FUNCTION__, __FILE__, __LINE__); \
} while (0);
} while (0)

/******************* GPU memory */
inline int testing_malloc_dev_internal(void **ptr, size_t size, const char *var,
Expand All @@ -79,7 +79,7 @@ inline int testing_malloc_dev_internal(void **ptr, size_t size, const char *var,
do { \
testing_malloc_dev_internal((void **)&ptr, size * sizeof(type), #ptr, \
__FUNCTION__, __FILE__, __LINE__); \
} while (0);
} while (0)

inline int testing_free_dev_internal(void *ptr, const char *var,
const char *func, const char *file,
Expand All @@ -95,7 +95,7 @@ inline int testing_free_dev_internal(void *ptr, const char *var,
#define TESTING_FREE_DEV(ptr) \
do { \
testing_free_dev_internal(ptr, #ptr, __FUNCTION__, __FILE__, __LINE__); \
} while (0);
} while (0)

#endif // HAVE_CUDA

Expand Down
4 changes: 3 additions & 1 deletion cusolver_compute_SVDpseudoInverse.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@ typedef int errno_t;
#include "COREMOD_tools/COREMOD_tools.h"
#include "CommandLineInterface/timeutils.h"
#include "cudacomp_types.h"
#include "cusolver_symmetrize.h"

extern void ssymmetrize_lower(float *dA, int ldda);
extern void dsymmetrize_lower(double *dA, int ldda);

static struct cusolver_compute_SVDpseudoInverse_data CUSOLVER_DATA = {
.loop_iter = 0,
Expand Down
5 changes: 5 additions & 0 deletions cusolver_symmetrize.cu
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
#include "cuda.h"
#include "cuda_runtime.h"

#include "cusolver_symmetrize.h"

#define NB 64
Expand Down Expand Up @@ -40,6 +43,7 @@ __global__ void kern_fill_dsym_matrix(char src_uplo, double *data, int N,
}
}

extern "C"
void ssymmetrize_lower(float *dA, int ldda) {
if (ldda == 0) return;

Expand All @@ -49,6 +53,7 @@ void ssymmetrize_lower(float *dA, int ldda) {
kern_fill_ssym_matrix<<<grid, threads, 0>>>('L', dA, N, ldda);
}

extern "C"
void dsymmetrize_lower(double *dA, int ldda) {
if (ldda == 0) return;

Expand Down
6 changes: 6 additions & 0 deletions cusolver_symmetrize.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@

#ifdef HAVE_CUDA

#include "cuda.h"
#include "cuda_runtime.h"

extern "C"
void ssymmetrize_lower(float *dA, int ldda);

extern "C"
void dsymmetrize_lower(double *dA, int ldda);

#endif // HAVE_CUDA
Expand Down

0 comments on commit 7c400da

Please sign in to comment.