Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Initial bindings skeleton.

  • Loading branch information...
commit bfbce813b670b0cf31475aeeb60f9092351649e3 1 parent 585729c
@kashif kashif authored
View
7 src/bindings.cpp
@@ -0,0 +1,7 @@
+#include "bindings.hpp"
+#include "cuda_device.hpp"
+
+extern "C"
+void init (Handle<Object> target) {
+ CudaDevice::Initialize(target);
+}
View
11 src/bindings.hpp
@@ -0,0 +1,11 @@
+#ifndef BINDINGS_HPP
+#define BINDINGS_HPP
+
+#include <v8.h>
+#include <node.h>
+#include <node_events.h>
+
+using namespace v8;
+using namespace node;
+
+#endif
View
5 src/cuda_device.cpp
@@ -0,0 +1,5 @@
+#include "cuda_device.hpp"
+
+CudaDevice::CudaDevice(): EventEmitter() {
+ cuDeviceGet(&m_device, 0);
+}
View
20 src/cuda_device.hpp
@@ -0,0 +1,20 @@
+#ifndef CUDA_DEVICE_HPP
+#define CUDA_DEVICE_HPP
+
+#include <cuda.h>
+
+#include "bindings.hpp"
+
+class CudaDevice : public EventEmitter {
+public:
+ static void Initialize (Handle<Object> target);
+ static Persistent<FunctionTemplate> constructor_template;
+
+protected:
+ CUdevice m_device;
+
+ CudaDevice();
+ ~CudaDevice();
+};
+
+#endif
View
27 wscript
@@ -0,0 +1,27 @@
+import Options
+from os import unlink, symlink, system
+from os.path import exists, abspath
+
+srcdir = "."
+blddir = "build"
+VERSION = "0.0.1"
+
+def set_options(opt):
+ opt.tool_options("compiler_cxx")
+
+def configure(conf):
+ conf.check_tool("compiler_cxx")
+ conf.check_tool("node_addon")
+
+ if not conf.check_cfg(package='cuda', uselib_store='CUDA'):
+ if not conf.check(lib="cuda",
+ libpath=['/usr/local/cuda/lib'],
+ includes=['/usr/local/cuda/include'],
+ uselib_store="CUDA"):
+ conf.fatal('Cannot find CUDA library.');
+
+def build(bld):
+ obj = bld.new_task_gen('cxx', 'shlib', 'node_addon')
+ obj.target = "cuda"
+ obj.source = "src/bindings.cpp src/cuda_device.cpp"
+ obj.uselib = "CUDA"
Please sign in to comment.
Something went wrong with that request. Please try again.