From 1024a62072c3ee7bcbcf6e8991eb7be852165ec9 Mon Sep 17 00:00:00 2001 From: dmed256 Date: Sat, 25 Aug 2018 23:16:57 -0500 Subject: [PATCH] [GC] OpenMP GC error fixes --- src/mode/openmp/device.cpp | 4 ++-- tests/src/c/memory.cpp | 13 ++++++++++++- tests/src/tools/gc.cpp | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/mode/openmp/device.cpp b/src/mode/openmp/device.cpp index 8001d8262..9bcfb08bb 100644 --- a/src/mode/openmp/device.cpp +++ b/src/mode/openmp/device.cpp @@ -102,9 +102,9 @@ namespace occa { allKernelProps); if (k && usingOpenMP) { - k->modeDevice->removeRef(); + k->modeDevice->removeKernelRef(k); k->modeDevice = this; - addRef(); + addKernelRef(k); } return k; diff --git a/tests/src/c/memory.cpp b/tests/src/c/memory.cpp index ba7803425..7776cb6fc 100644 --- a/tests/src/c/memory.cpp +++ b/tests/src/c/memory.cpp @@ -275,8 +275,19 @@ void testInteropMethods() { ptr[i] = i; } - mem2 = occaWrapCpuMemory(ptr, bytes); + mem2 = occaWrapCpuMemory(occaHost(), + ptr, + bytes, + occaDefault); + occaProperties props = ( + occaCreatePropertiesFromString("foo: 'bar'") + ); + mem2 = occaWrapCpuMemory(occaHost(), + ptr, + bytes, + props); occaFree(mem1); occaFree(mem2); + occaFree(props); } diff --git a/tests/src/tools/gc.cpp b/tests/src/tools/gc.cpp index d93a1bd72..d1e64eaa6 100644 --- a/tests/src/tools/gc.cpp +++ b/tests/src/tools/gc.cpp @@ -69,7 +69,7 @@ void testWithRefs() { } void testRingEntry() { - occa::gc::ringEntry a, b; + occa::gc::ringEntry_t a, b; ASSERT_EQ(a.leftRingEntry, &a); @@ -96,8 +96,8 @@ void testRingEntry() { } void testRing() { - occa::gc::ringEntry a, b, c; - occa::gc::ring values; + occa::gc::ringEntry_t a, b, c; + occa::gc::ring_t values; ASSERT_EQ((void*) values.head, (void*) NULL);