cumo 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -1
- data/ext/cumo/cuda/cublas.c +3 -2
- data/ext/cumo/cuda/driver.c +3 -2
- data/ext/cumo/cumo.c +22 -0
- data/ext/cumo/include/cumo.h +25 -2
- data/ext/cumo/include/cumo/template.h +0 -15
- data/ext/cumo/narray/gen/tmpl/rand.c +0 -1
- data/ext/cumo/narray/index.c +1 -0
- data/ext/cumo/narray/ndloop.c +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a00113b29c4cd47082953a1327d8b5c30c29543d42d7b9c3de1fb81a06d44c3
|
4
|
+
data.tar.gz: 78014e61144693436adc2c822b40f4520615cbeda8a7776600a3cc53cbe39474
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e93d0fb045838fd34a047488a287dfc6c777106255b7e0783e56148967f0c773c4e14a6f9590360f2521b277cdb46cd71bdbe307bd0cf68456942e8e26449a7c
|
7
|
+
data.tar.gz: cab27fb6523bc0362b5b5bb8e144dbed26c7636bfa7adc8ba69be3f9ad408dd00c2b2a28f59a750108856bb50986f8a398adf0844cfed8150f79475002da56c3
|
data/README.md
CHANGED
@@ -190,7 +190,7 @@ ln -sf "$HOME/opt/ccache/bin/ccache" "$HOME/opt/ccache/bin/nvcc"
|
|
190
190
|
Use `MAKEFLAGS` environment variable to specify `make` command options. You can build in parallel as:
|
191
191
|
|
192
192
|
```
|
193
|
-
bundle exec MAKEFLAG=-j8 rake compile
|
193
|
+
bundle exec env MAKEFLAG=-j8 rake compile
|
194
194
|
```
|
195
195
|
|
196
196
|
### Specify nvcc --generate-code options
|
@@ -242,6 +242,23 @@ bundle exec DTYPE=dfloat ruby test/narray_test.rb
|
|
242
242
|
bundle exec CUDA_LAUNCH_BLOCKING=1
|
243
243
|
```
|
244
244
|
|
245
|
+
### Disable Cumo warnings
|
246
|
+
|
247
|
+
As default, cumo shows some warnings once for each.
|
248
|
+
|
249
|
+
It is possible to disable by followings:
|
250
|
+
|
251
|
+
```
|
252
|
+
export CUMO_SHOW_WARNING=OFF
|
253
|
+
```
|
254
|
+
|
255
|
+
You may want to show warnings everytime rather than once:
|
256
|
+
|
257
|
+
```
|
258
|
+
export CUMO_SHOW_WARNING=ON
|
259
|
+
export CUMO_WARNING_ONCE=OFF
|
260
|
+
```
|
261
|
+
|
245
262
|
## Contributing
|
246
263
|
|
247
264
|
Bug reports and pull requests are welcome on GitHub at https://github.com/sonots/cumo.
|
data/ext/cumo/cuda/cublas.c
CHANGED
@@ -16,7 +16,7 @@ get_cublas_error_msg(cublasStatus_t error) {
|
|
16
16
|
switch (error) {
|
17
17
|
#define RETURN_MSG(msg) \
|
18
18
|
case msg: \
|
19
|
-
return #msg
|
19
|
+
return (char*)#msg
|
20
20
|
|
21
21
|
RETURN_MSG(CUBLAS_STATUS_SUCCESS);
|
22
22
|
RETURN_MSG(CUBLAS_STATUS_NOT_INITIALIZED);
|
@@ -47,6 +47,7 @@ cublasHandle_t
|
|
47
47
|
cumo_cuda_cublas_handle()
|
48
48
|
{
|
49
49
|
static cublasHandle_t *handles = 0; // handle is never destroyed
|
50
|
+
int device;
|
50
51
|
if (handles == 0) {
|
51
52
|
int i;
|
52
53
|
int device_count = cumo_cuda_runtime_get_device_count();
|
@@ -55,7 +56,7 @@ cumo_cuda_cublas_handle()
|
|
55
56
|
handles[i] = 0;
|
56
57
|
}
|
57
58
|
}
|
58
|
-
|
59
|
+
device = cumo_cuda_runtime_get_device();
|
59
60
|
if (handles[device] == 0) {
|
60
61
|
cublasCreate(&handles[device]);
|
61
62
|
}
|
data/ext/cumo/cuda/driver.c
CHANGED
@@ -387,6 +387,9 @@ rb_cuModuleUnload(VALUE self, VALUE hmod)
|
|
387
387
|
void
|
388
388
|
Init_cumo_cuda_driver()
|
389
389
|
{
|
390
|
+
CUdevice cuDevice;
|
391
|
+
CUcontext context;
|
392
|
+
|
390
393
|
VALUE mCumo = rb_define_module("Cumo");
|
391
394
|
VALUE mCUDA = rb_define_module_under(mCumo, "CUDA");
|
392
395
|
mDriver = rb_define_module_under(mCUDA, "Driver");
|
@@ -413,8 +416,6 @@ Init_cumo_cuda_driver()
|
|
413
416
|
rb_define_const(mDriver, "CU_JIT_INPUT_OBJECT", INT2NUM(CU_JIT_INPUT_OBJECT));
|
414
417
|
rb_define_const(mDriver, "CU_JIT_INPUT_PTX", INT2NUM(CU_JIT_INPUT_PTX));
|
415
418
|
|
416
|
-
CUdevice cuDevice;
|
417
|
-
CUcontext context;
|
418
419
|
cuInit(0);
|
419
420
|
cuDeviceGet(&cuDevice, 0);
|
420
421
|
cuCtxCreate(&context, 0, cuDevice);
|
data/ext/cumo/cumo.c
CHANGED
@@ -47,6 +47,20 @@ bool cumo_compatible_mode_enabled_p()
|
|
47
47
|
return cumo_compatible_mode_enabled;
|
48
48
|
}
|
49
49
|
|
50
|
+
static bool cumo_show_warning_enabled;
|
51
|
+
|
52
|
+
bool cumo_show_warning_enabled_p()
|
53
|
+
{
|
54
|
+
return cumo_show_warning_enabled;
|
55
|
+
}
|
56
|
+
|
57
|
+
static bool cumo_warning_once_enabled;
|
58
|
+
|
59
|
+
bool cumo_warning_once_enabled_p()
|
60
|
+
{
|
61
|
+
return cumo_warning_once_enabled;
|
62
|
+
}
|
63
|
+
|
50
64
|
/*
|
51
65
|
Enable Numo NArray compatible mode.
|
52
66
|
|
@@ -110,6 +124,14 @@ Init_cumo()
|
|
110
124
|
env = getenv("CUMO_COMPATIBLE_MODE");
|
111
125
|
cumo_compatible_mode_enabled = (env != NULL && strcmp(env, "OFF") != 0 && strcmp(env, "0") != 0 && strcmp(env, "NO") != 0);
|
112
126
|
|
127
|
+
// default is true
|
128
|
+
env = getenv("CUMO_SHOW_WARNING");
|
129
|
+
cumo_show_warning_enabled = env == NULL || (strcmp(env, "OFF") != 0 && strcmp(env, "0") != 0 && strcmp(env, "NO") != 0);
|
130
|
+
|
131
|
+
// default is true
|
132
|
+
env = getenv("CUMO_WARNING_ONCE");
|
133
|
+
cumo_warning_once_enabled = env == NULL || (strcmp(env, "OFF") != 0 && strcmp(env, "0") != 0 && strcmp(env, "NO") != 0);
|
134
|
+
|
113
135
|
Init_cumo_narray();
|
114
136
|
|
115
137
|
Init_cumo_na_step();
|
data/ext/cumo/include/cumo.h
CHANGED
@@ -10,10 +10,33 @@ extern "C" {
|
|
10
10
|
#endif
|
11
11
|
#endif
|
12
12
|
|
13
|
-
#define CUMO_VERSION "0.1.
|
14
|
-
#define CUMO_VERSION_CODE
|
13
|
+
#define CUMO_VERSION "0.1.2"
|
14
|
+
#define CUMO_VERSION_CODE 12
|
15
15
|
|
16
16
|
bool cumo_compatible_mode_enabled_p();
|
17
|
+
bool cumo_show_warning_enabled_p();
|
18
|
+
bool cumo_warning_once_enabled_p();
|
19
|
+
|
20
|
+
#define CUMO_SHOW_WARNING_ONCE( c_str ) \
|
21
|
+
{ \
|
22
|
+
if (cumo_show_warning_enabled_p()) { \
|
23
|
+
if (cumo_warning_once_enabled_p()) { \
|
24
|
+
static bool show_warning = true; \
|
25
|
+
if (show_warning) { \
|
26
|
+
fprintf(stderr, (c_str)); \
|
27
|
+
show_warning = false; \
|
28
|
+
} \
|
29
|
+
} else { \
|
30
|
+
fprintf(stderr, (c_str)); \
|
31
|
+
} \
|
32
|
+
} \
|
33
|
+
}
|
34
|
+
|
35
|
+
#define CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE( func_name, type_name ) \
|
36
|
+
CUMO_SHOW_WARNING_ONCE("Warning: FIXME: Method \"" func_name "\" for dtype \"" type_name "\" synchronizes with CPU.\n")
|
37
|
+
|
38
|
+
#define CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE( func_name, type_name ) \
|
39
|
+
CUMO_SHOW_WARNING_ONCE("Warning: Method \"" func_name "\" for dtype \"" type_name "\" synchronizes with CPU.\n")
|
17
40
|
|
18
41
|
#if defined(__cplusplus)
|
19
42
|
#if 0
|
@@ -145,19 +145,4 @@ cumo_is_aligned_step(const ssize_t step, const size_t alignment)
|
|
145
145
|
return ((step) & ((alignment)-1)) == 0;
|
146
146
|
}
|
147
147
|
|
148
|
-
#define CUMO_SHOW_WARNING_ONCE( c_str ) \
|
149
|
-
{ \
|
150
|
-
static bool show_warning = true; \
|
151
|
-
if (show_warning) { \
|
152
|
-
fprintf(stderr, (c_str)); \
|
153
|
-
show_warning = false; \
|
154
|
-
} \
|
155
|
-
}
|
156
|
-
|
157
|
-
#define CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE( func_name, type_name ) \
|
158
|
-
CUMO_SHOW_WARNING_ONCE("Warning: FIXME: Method \"" func_name "\" for dtype \"" type_name "\" synchronizes with CPU.\n")
|
159
|
-
|
160
|
-
#define CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE( func_name, type_name ) \
|
161
|
-
CUMO_SHOW_WARNING_ONCE("Warning: Method \"" func_name "\" for dtype \"" type_name "\" synchronizes with CPU.\n")
|
162
|
-
|
163
148
|
#endif /* ifndef CUMO_TEMPLATE_H */
|
@@ -92,7 +92,6 @@ static void
|
|
92
92
|
<%=shift_set%>
|
93
93
|
|
94
94
|
CUMO_SHOW_SYNCHRONIZE_FIXME_WARNING_ONCE("<%=name%>", "<%=type_name%>");
|
95
|
-
CUMO_SHOW_SYNCHRONIZE_WARNING_ONCE("<%=name%>", "<%=type_name%>");
|
96
95
|
cumo_cuda_runtime_check_status(cudaDeviceSynchronize());
|
97
96
|
if (idx1) {
|
98
97
|
for (; i--;) {
|
data/ext/cumo/narray/index.c
CHANGED
data/ext/cumo/narray/ndloop.c
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cumo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Naotoshi Seo
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-11-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: numo-narray
|