Fixed linker error by putting includes and cuda function in extern 'C'

This commit is contained in:
Maximilian Gaul 2021-11-11 14:49:29 +01:00
parent 3428974730
commit 280f595b7f
3 changed files with 15 additions and 10 deletions

View File

@ -22,7 +22,7 @@ INDEX_TRACER ?= false
# Vector width (elements) for index and distance tracer
VECTOR_WIDTH ?= 8
# Compute statistics
COMPUTE_STATS ?= true
COMPUTE_STATS ?= false
#Feature options
OPTIONS = -DALIGNMENT=64

View File

@ -12,4 +12,4 @@ ASFLAGS = -masm=intel
LFLAGS =
DEFINES = -D_GNU_SOURCE -DLIKWID_PERFMON
INCLUDES = $(LIKWID_INC)
LIBS = -lm $(LIKWID_LIB) -llikwid
LIBS = -lm $(LIKWID_LIB) -llikwid -lcuda -lcudart

View File

@ -26,12 +26,14 @@
#include <cuda_runtime.h>
#include <device_launch_parameters.h>
extern "C" {
#include <likwid-marker.h>
#include <timing.h>
#include <neighbor.h>
#include <parameter.h>
#include <atom.h>
}
// cuda kernel
__global__ void calc_force(
@ -69,6 +71,8 @@ __global__ void calc_force(
}
}
extern "C" {
double computeForce(
Parameter *param,
Atom *atom,
@ -90,7 +94,7 @@ double computeForce(
fz[i] = 0.0;
}
// double S = getTimeStamp();
double S = getTimeStamp();
LIKWID_MARKER_START("force");
#pragma omp parallel for
@ -167,8 +171,9 @@ double computeForce(
}
LIKWID_MARKER_STOP("force");
// double E = getTimeStamp();
double E = getTimeStamp();
// return E-S;
return E-S;
return 0;
}
}