summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/linalg_test.cu2
-rw-r--r--tests/linalg_test.py8
-rw-r--r--tests/matrix_test.cu2
-rw-r--r--tests/matrix_test.py9
-rw-r--r--tests/rotate_test.cu2
-rw-r--r--tests/rotate_test.py10
6 files changed, 24 insertions, 9 deletions
diff --git a/tests/linalg_test.cu b/tests/linalg_test.cu
index b61488f..4e9c983 100644
--- a/tests/linalg_test.cu
+++ b/tests/linalg_test.cu
@@ -1,5 +1,7 @@
//-*-c-*-
+#include "linalg.h"
+
extern "C"
{
diff --git a/tests/linalg_test.py b/tests/linalg_test.py
index 44c4b52..31688d9 100644
--- a/tests/linalg_test.py
+++ b/tests/linalg_test.py
@@ -1,3 +1,4 @@
+import os
import numpy as np
from pycuda import autoinit
from pycuda.compiler import SourceModule
@@ -8,9 +9,12 @@ float3 = gpuarray.vec.float3
print 'device %s' % autoinit.device.name()
-source = open('../linalg.h').read() + open('linalg_test.cu').read()
+current_directory = os.path.split(os.path.realpath(__file__))[0]
+source_directory = current_directory + '/../src'
-mod = SourceModule(source, no_extern_c=True, arch='sm_13')
+source = open(current_directory + '/linalg_test.cu').read()
+
+mod = SourceModule(source, options=['-I' + source_directory], no_extern_c=True, cache_dir=False)
float3add = mod.get_function('float3add')
float3addequal = mod.get_function('float3addequal')
diff --git a/tests/matrix_test.cu b/tests/matrix_test.cu
index 99e13dc..d64cb34 100644
--- a/tests/matrix_test.cu
+++ b/tests/matrix_test.cu
@@ -1,5 +1,7 @@
//-*-c-*-
+#include "matrix.h"
+
__device__ Matrix array2matrix(float *a)
{
return make_matrix(a[0], a[1], a[2],
diff --git a/tests/matrix_test.py b/tests/matrix_test.py
index bc4115e..c843025 100644
--- a/tests/matrix_test.py
+++ b/tests/matrix_test.py
@@ -1,3 +1,4 @@
+import os
import numpy as np
from pycuda import autoinit
from pycuda.compiler import SourceModule
@@ -8,10 +9,12 @@ float3 = gpuarray.vec.float3
print 'device %s' % autoinit.device.name()
-source = open('../matrix.h').read() + open('../linalg.h').read() + \
- open('matrix_test.cu').read()
+current_directory = os.path.split(os.path.realpath(__file__))[0]
+source_directory = current_directory + '/../src'
-mod = SourceModule(source, no_extern_c=True, arch='sm_13')
+source = open(current_directory + '/matrix_test.cu').read()
+
+mod = SourceModule(source, options=['-I' + source_directory], no_extern_c=True, cache_dir=False)
det = mod.get_function('det')
inv = mod.get_function('inv')
diff --git a/tests/rotate_test.cu b/tests/rotate_test.cu
index 96e4d75..6cafc12 100644
--- a/tests/rotate_test.cu
+++ b/tests/rotate_test.cu
@@ -1,6 +1,6 @@
//-*-c-*-
-
+#include "rotate.h"
extern "C"
{
diff --git a/tests/rotate_test.py b/tests/rotate_test.py
index 8c2cfcb..92eff84 100644
--- a/tests/rotate_test.py
+++ b/tests/rotate_test.py
@@ -1,3 +1,4 @@
+import os
import numpy as np
from pycuda import autoinit
from pycuda.compiler import SourceModule
@@ -16,9 +17,12 @@ def rotate(x, phi, n):
print 'device %s' % autoinit.device.name()
-source = open('../linalg.h').read() + open('../matrix.h').read() + \
- open('../rotate.h').read() + open('rotate_test.cu').read()
-mod = SourceModule(source, no_extern_c=True, arch='sm_13')
+current_directory = os.path.split(os.path.realpath(__file__))[0]
+source_directory = current_directory + '/../src'
+
+source = open(current_directory + '/rotate_test.cu').read()
+
+mod = SourceModule(source, options=['-I' + source_directory], no_extern_c=True, cache_dir=False)
rotate_gpu = mod.get_function('rotate')