Giter Club home page Giter Club logo

cl's People

Contributors

arpieb avatar bsmr avatar dgud avatar fenollp avatar kbmurali avatar pianiel avatar quentusrex avatar tonyrog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cl's Issues

Can't run examples (undefined clu:setup)

Running rebar compile seems to work, and I ensure that $ERL_LIBS is set to the cl folder:

$ echo $ERL_LIBS
/Users/mrluc/projects/mine/elixir/cl/

 $ rebar compile
 ==> cl (compile)

Then, entering the examples/ directory and type make, and again it seems to work:

$ make
erlc -W -pa ../../cl/ebin -o . cl_basic.erl
erlc -W -pa ../../cl/ebin -o . cl_square_float.erl
erlc -W -pa ../../cl/ebin -o . cl_map.erl
erlc -W -pa ../../cl/ebin -o . cl_binary_test.erl
erlc -W -pa ../../cl/ebin -o . cl_bandwidth.erl
erlc -W -pa ../../cl/ebin -o . cl_mul.erl
erlc -W -pa ../../cl/ebin -o . cl_test.erl
erlc -W -pa ../../cl/ebin -o . cl_buffer.erl
erlc -W -pa ../../cl/ebin -o . cl_image.erl
erlc -W -pa ../../cl/ebin -o . cl_compile.erl

However, as there's no guidance on how to run the examples, I tried first the following:

$ erl -s cl_basic
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

{"init terminating in do_boot",{undef,[{cl_basic,start,[],[]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

Okay, undefined cl_basic:start; after peaking inside the sources, tried this:

$ erl -s cl_basic test
Erlang/OTP 17 [erts-6.4] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

{"init terminating in do_boot",{undef,[{clu,setup,[all],[]},{cl_basic,test,1,[{file,"cl_basic.erl"},{line,13}]},{init,start_it,1,[]},{init,start_em,1,[]}]}}

Crash dump was written to: erl_crash.dump
init terminating in do_boot ()

Which seems to be a bona fide error -- it can't find clu:setup, ie the example doesn't seem to be finding/using the ../../cl/ebin files despite me explicitly setting the ERL_LIBS env var as mentioned in Readme.

Any thoughts on what I'm missing?

Non-standard application name/version for cl app breaks releases

The problem in:

cl.app:4:              {vsn,"cl-1.2"}

The Relx tool (and probably reltool too) expects just "1.2" and adds app name prefix by itself. The result is application named "cl-cl-1.2".

I checked this on 3 versions of cl:

_rel/releases/RELEASES:17:           {cl,"cl-1.2","./lib/cl-cl-1.2"},
deps/cl/ebin/cl.app:4:              {vsn,"cl-1.2"},
Binary file _rel/releases/0.0.1/ts.boot matches
_rel/releases/0.0.1/ts.script:100:     {path,["$ROOT/lib/cl-cl-1.2/ebin"]},
_rel/releases/0.0.1/ts.script:177:          "$ROOT/lib/protobuffs-0.8.1/ebin","$ROOT/lib/cl-cl-1.2/ebin",
_rel/releases/0.0.1/ts.script:479:                   {vsn,"cl-1.2"},
_rel/lib/cl-cl-1.2/ebin/cl.app:4:              {vsn,"cl-1.2"},

latest master branch:

_rel/releases/RELEASES:17:           {cl,"cl-1.2.1-1-g1ea2dfe","./lib/cl-cl-1.2.1-1-g1ea2dfe"},
deps/cl/ebin/cl.app:4:              {vsn,"cl-1.2.1-1-g1ea2dfe"},
Binary file _rel/releases/0.0.1/ts.boot matches
_rel/releases/0.0.1/ts.rel:18:          {cl,"cl-1.2.1-1-g1ea2dfe"},
_rel/releases/0.0.1/ts.script:100:     {path,["$ROOT/lib/cl-cl-1.2.1-1-g1ea2dfe/ebin"]},
_rel/releases/0.0.1/ts.script:178:          "$ROOT/lib/cl-cl-1.2.1-1-g1ea2dfe/ebin",
_rel/releases/0.0.1/ts.script:480:                   {vsn,"cl-1.2.1-1-g1ea2dfe"},

latest dev branch:

RELEASES:17:           {cl,"cl-1.1-38-ga4c86f4","./lib/cl-cl-1.1-38-ga4c86f4"},
deps/cl/ebin/cl.app:4:              {vsn,"cl-1.1-38-ga4c86f4"},
Binary file 0.0.1/ts.boot matches
0.0.1/ts.rel:18:          {cl,"cl-1.1-38-ga4c86f4"},
0.0.1/ts.script:100:     {path,["$ROOT/lib/cl-cl-1.1-38-ga4c86f4/ebin"]},
0.0.1/ts.script:178:          "$ROOT/lib/cl-cl-1.1-38-ga4c86f4/ebin","$ROOT/lib/ranch-0.9.0/ebin",
0.0.1/ts.script:480:                   {vsn,"cl-1.1-38-ga4c86f4"},

My environment:

# Ubuntu 12.04 LTS 64 bit
$ uname -a
Linux hostname 3.8.0-35-generic #52~precise1-Ubuntu SMP Thu Jan 30 17:24:40 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux

$ erl
Erlang R16B03-1 (erts-5.10.4) [source] [64-bit] [smp:4:4] [async-threads:10] [kernel-poll:false]

$ rebar --version
rebar 2.1.0 R16B03-1 20140213_214310 git 2.1.0-13-g30531b6

$ relx --version
0.6.0

cl_map example does not work for device all, but is ok with cpu | gpu

Hey,
I get this error with this line set to all :

Program:
__kernel void example(__global float*in,__global float*out,const uint n)
{  size_t i = get_global_id(0);
  if (i < n) {
  float X= in[i];
out[i] = X*X+1;
  }
}

Kws = [{kwork,{command_queue_t,548021856,<<>>},
              128,3000,4,undefined,undefined,undefined,undefined,undefined,
              undefined,4,undefined},
       {kwork,{command_queue_t,548021944,<<>>},
              512,1200,16,undefined,undefined,undefined,undefined,undefined,
              undefined,4,undefined}]
Kws1 = [{kwork,{command_queue_t,548021856,<<>>},
               128,3000,4,0.38461538461538464,undefined,undefined,undefined,
               undefined,undefined,4,undefined},
        {kwork,{command_queue_t,548021944,<<>>},
               512,1200,16,0.6153846153846154,undefined,undefined,undefined,
               undefined,undefined,4,undefined}]
N=1024, M=630, L=512, R=394, ML=1024
Kws2 = [{kwork,{command_queue_t,548021944,<<>>},
               512,1200,16,0.6153846153846154,undefined,undefined,undefined,
               undefined,undefined,4,
               <<0,0,128,63,0,0,0,64,0,0,64,64,0,0,128,64,0,0,160,64,0,0,192,
                        … snip …
                 0,0,127,68,0,64,127,68,0,128,127,68,0,192,127,68,0,0,128,68>>},
        {kwork,{command_queue_t,548021856,<<>>},
               128,3000,4,0.38461538461538464,undefined,undefined,undefined,
               undefined,undefined,4,<<>>}]
c_src/cl_nif.c:2927: CL ERROR ASYNC: [CL_INVALID_BUFFER_SIZE] : OpenCL Error : clCreateBuffer failed: Invalid buffer size (0 bytes)!
** exception error: no match of right hand side value {error,invalid_buffer_size}
     in function  cl_map:'-run/2-fun-3-'/2 (cl_map.erl, line 71)
     in call from lists:map/2 (lists.erl, line 1224)
     in call from lists:map/2 (lists.erl, line 1224)
     in call from cl_map:run/2 (cl_map.erl, line 68)
     in call from cl_map:test/0 (cl_map.erl, line 22)

My configuration: (from http://stackoverflow.com/a/7898347/1418165)

Device Intel(R) Core(TM) i7-3540M CPU @ 3.00GHz supports OpenCL 1.2
Device HD Graphics 4000 supports OpenCL 1.2

But everything is fine with either cpu or gpu.

Warnings when building it in Mingw64+Intel SDK 2017R2

I noticed the project was compiled and the .beam and .dll files generated, but there were warnings that seems to be relevant:

micheus@/F/unixlike/src/cl (master)[64b]
$ CC=gcc ../rebar3/rebar3 compile
===> Verifying dependencies...
===> Compiling cl
make: Entering directory 'f:/unixlike/src/cl/c_src'
make nif TYPE=release
make[1]: Entering directory 'f:/unixlike/src/cl/c_src'
gcc -c -o cl_nif.o -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -Wno-deprecated-declarations -Wno-missing-field-initializers -I"f:/Program Files/erl9.3/usr/include" -D__WIN32__ -shared -IF:/unixlike/mingw64/include -m64 -DWIN32 -O3 cl_nif.c

cl_nif.c: In function 'ecl_get_kernel_arg_info':
cl_nif.c:5225:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
         (void*) (unsigned long) arg_index,
         ^
cl_nif.c: In function 'dlopen':
cl_nif.c:7353:37: warning: unused parameter 'unused' [-Wunused-parameter]
 HMODULE dlopen(const CHAR *DLL, int unused) {
                                     ^

gcc -c -o cl_hash.o -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -Wno-deprecated-declarations -Wno-missing-field-initializers -I"f:/Program Files/erl9.3/usr/include" -D__WIN32__ -shared -IF:/unixlike/mingw64/include -m64 -DWIN32 -O3 cl_hash.c
gcc -shared -o ../priv/cl_nif.dll cl_nif.o cl_hash.o -LF:/unixlike/mingw64/lib/x64 -lOpenCL
make[1]: Leaving directory 'f:/unixlike/src/cl/c_src'
make: Leaving directory 'f:/unixlike/src/cl/c_src'
ok

My dev environment:

  • MingW64;
  • Erlang V9.3 (20);
  • Rebar3;
  • Intel SDK 2017 R2 (mingw64\lib\OpenCL.lib <= sdk\lib\x64\OpenCL.lib and mingw64\include*.* <= sdk\include*.*);
  • Windows 7 x64.

`%VSN%` macro is not compatible with rebar get-deps

when running

rebar get-deps

I got following:

Pulling cl from {git,"[email protected]:USER/cl.git",{branch,"master"}}
Initialized empty Git repository in /home/USER/REPO/deps/cl/.git/
ERROR: Dependency dir /home/USER/REPO/deps/cl failed application validation with reason:
{version_mismatch,{"/home/USER/REPO/deps/cl/src/cl.app.src",
                   {expected,"1.1"},
                   {has,"%VSN%"}}}.
ERROR: 'get-deps' failed while processing /home/USER/REPO: rebar_abort

Path to OpenCL `lib` folder for AMD APP in dev branch

  1. This code assumes, that OpenCL lib are under $OPENCL_DIR/lib:

https://github.com/tonyrog/cl/blob/dev/rebar.config.script#L37

When for AMD APP 2.8 it's under $OPENCL_DIR/lib/x86 and possibly in 64 bit under $OPENCL_DIR/lib/x86-64

  1. Also in addition to this common include path for NVIDIA CUDA it makes sense to add include path for AMD APP too as a sensible defaults:

    -I/usr/include/nvidia-current
    -I/opt/AMDAPP/include

https://github.com/tonyrog/cl/blob/dev/rebar.config.script#L34

Update code to take advantage of "dirty" schedulers

Opening for a thread of discussion - and willing to make the changes if interested. I'm testing the cl module on the following systems:

  • Linux system running a pair of Nvidia Titan Xp GPUs with a 12-core Intel CPU + Nvidia's OpenCL drivers installed
  • MacPro with an AMD Radeon RX580 with 2x12-core Intel CPUs + macOS 10.14.3 with native Apple OpenCL drivers installed
  • MacBook Pro with 2xAMD GPUs, 4-core Intel CPU

While the Macs are executing OpenCL functions in sub-ms times, the Nvidia drivers are relatively slow when performing allocations of memory objects against the GPU, in some cases taking on the order of 100's of ms to complete (while actual operations on said allocated objects are damn snappy).

Since "dirty schedulers" were introduced ~Erlang 17.3 and compiled in as of ERTS 9.0, I was wondering if you'd be open to updating the NIF exports to execute all the cl NIF functions on the dirty schedulers if the ERTS being compiled for supports them.

BTW, really incredible undertaking here - before I found your repo I was building out my own OpenCL NIF so much respect for the fact you completed a full implementation!

Errors when running some tests on ubuntu 12.10 with AMD/ATI Radeon HD7750

ran all tests successfully on macbook air (i7) compiled with R16A

now having some issues on the linux system: ubuntu 12.10 with AMD/ATI Radeon HD7750, latest Radeon drivers for linux, R16A, latest OpenCL 1.2 headers from Khronos group site

following tests pass fine:
cl_binary_test:test().
cl_bandwidth:test().
cl_square_float:test().

following tests don't pass (with output):

cl_map:test().

192,125,68,0,0,126,68,0,64,126,68,0,128,126,68,0,192,126,68, 0,0,127,68,0,64,127,68,0,128,127,68,0,192,127,68,0,0,128,68>>}, {kwork,{command_queue_t,140481757717824,<<>>}, 256,800,8,0.26666666666666666,undefined,undefined,undefined, undefined,undefined,4,<<>>}] *\* exception error: no match of right hand side value {error,invalid_buffer_size} in function cl_map:'-run/2-fun-3-'/2 (cl_map.erl, line 73) in call from lists:map/2 (lists.erl, line 1224) in call from lists:map/2 (lists.erl, line 1224) in call from cl_map:run/2 (cl_map.erl, line 70) in call from cl_map:test/0 (cl_map.erl, line 24)

cl_basic:test().

{name,"Intel(R) Xeon(R) CPU E3-1230 V2 @ 3.30GHz"}, {vendor,"GenuineIntel"}, {driver_version,"1124.2 (sse2,avx)"}, {profile,"FULL_PROFILE"}, {version,"OpenCL 1.2 AMD-APP (1124.2)"}, {extensions,"cl_khr_fp64 cl_amd_fp64 cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_int64_base_atomics cl_khr_int64_extended_atomics cl_khr_3d_image_writes cl_khr_byte_addressable_store cl_khr_gl_sharing cl_ext_device_fission cl_amd_device_attribute_query cl_amd_vec3 cl_amd_printf cl_amd_media_ops cl_amd_media_ops2 cl_amd_popcnt "}, {platform,{platform_t,140481757713216,<<>>}}] ContextInfo: [{reference_count,1}, {devices,[{device_t,140481757713304,<<>>}, {device_t,140481757713392,<<>>}]}, {properties,[]}] Context2: [{reference_count,1}, {devices,[{device_t,140481757713304,<<>>}, {device_t,140481757713392,<<>>}]}, {properties,[]}] Queue: {command_queue_t,140481757721192,<<>>} QueueInfo: [{context,{context_t,140481757720152,<<>>}}, {device,{device_t,140481757713304,<<>>}}, {reference_count,1}, {properties,[]}] Queue: {command_queue_t,140481757746712,<<>>} QueueInfo: [{context,{context_t,140481757720152,<<>>}}, {device,{device_t,140481757713392,<<>>}}, {reference_count,1}, {properties,[]}] Sampler1: {sampler_t,140481757747104,<<>>} Sampler1Info: [{reference_count,1}, {context,{context_t,140481757720152,<<>>}}, {normalized_coords,true}, {addressing_mode,clamp}, {filter_mode,nearest}] *\* exception error: no match of right hand side value {error,invalid_value} in function cl_basic:test_sampler/2 (cl_basic.erl, line 148) in call from lists:foreach/2 (lists.erl, line 1313) in call from cl_basic:test/1 (cl_basic.erl, line 34)'

cl_test:test0().

** exception error: no match of right hand side value {error,invalid_platform}
in function cl_test:test0/1 (cl_test.erl, line 19)

cl_test:test1().

** exception error: no match of right hand side value {error,invalid_platform}
in function cl_test:test1/2 (cl_test.erl, line 56)

{vsn, git} in version tagged (1.2.1) release archive

In https://github.com/tonyrog/cl/archive/cl-1.2.1.tar.gz (it can also be present in 1.2 as well, I did not check), the file src/cl.app.src has the statement {vsn, git} rather than {vsn, "1.2.1"}. This results in the following error on a compilation attempt:

==> cl-cl-1.2.1 (compile)
Compiled src/clu.erl
Compiled src/cl13.erl
Compiled src/cl12.erl
Compiled src/cl11.erl
Compiled src/cl10.erl
Compiled src/cl.erl
Compiling c_src/cl_nif.c
Compiling c_src/cl_hash.c
ERROR: sh(git describe --always --tags)
failed with return code 128 and the following output:
fatal: Not a git repository (or any parent up to mount point /var/tmp/portage)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).

ERROR: compile failed while processing /var/tmp/portage/dev-libs/erlang-cl-1.2.1/work/cl-cl-1.2.1: rebar_abort

Changing for {vsn, "1.2.1"} fixes the issue.

OpenCL deprecation warnings when compiling the code

Hello,

Thanks for doing this!

I just compiled the code with the latest OpenCL, and got the following deprecation warnings.

Running OS X 10.8.2.

$ make
(cd c_src; make all)
autoheader; autoconf
./configure --with-wordsize=32
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for socketpair... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 4
checking size of long long... 8
checking size of void *... 4
checking size of size_t... 4
configure: Size void 4
configure: creating ./config.status
config.status: creating config.32.build
config.status: creating config.32.h
make nif TYPE=release WORDSIZE=32
gcc -c -o ../obj/release/32/cl_nif.o -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m32 -DWORDSIZE=32 -DDARWIN -no-cpp-precomp cl_nif.c
cl_nif.c: In function ‘ecl_create_image2d’:
cl_nif.c:2909: warning: ‘clCreateImage2D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1204)
cl_nif.c: In function ‘ecl_create_image3d’:
cl_nif.c:2975: warning: ‘clCreateImage3D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1216)
cl_nif.c: In function ‘ecl_unload_compiler’:
cl_nif.c:3313: warning: ‘clUnloadCompiler’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1231)
cl_nif.c: In function ‘ecl_enqueue_marker’:
cl_nif.c:3851: warning: ‘clEnqueueMarker’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1220)
cl_nif.c: In function ‘ecl_enqueue_wait_for_events’:
cl_nif.c:3878: warning: ‘clEnqueueWaitForEvents’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1225)
cl_nif.c: In function ‘ecl_enqueue_barrier’:
cl_nif.c:4492: warning: ‘clEnqueueBarrier’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1228)
gcc -c -o ../obj/release/32/cl_hash.o -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m32 -DWORDSIZE=32 -DDARWIN -no-cpp-precomp cl_hash.c
gcc -m32 -bundle -flat_namespace -undefined suppress -o ../lib/release/32/cl_nif.so ../obj/release/32/cl_nif.o ../obj/release/32/cl_hash.o -framework OpenCL
make nif TYPE=debug WORDSIZE=32
gcc -c -o ../obj/debug/32/cl_nif.o -Ddebug -DDEBUG -g -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m32 -DWORDSIZE=32 -DDARWIN -no-cpp-precomp cl_nif.c
cl_nif.c: In function ‘ecl_create_image2d’:
cl_nif.c:2909: warning: ‘clCreateImage2D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1204)
cl_nif.c: In function ‘ecl_create_image3d’:
cl_nif.c:2975: warning: ‘clCreateImage3D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1216)
cl_nif.c: In function ‘ecl_unload_compiler’:
cl_nif.c:3313: warning: ‘clUnloadCompiler’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1231)
cl_nif.c: In function ‘ecl_enqueue_marker’:
cl_nif.c:3851: warning: ‘clEnqueueMarker’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1220)
cl_nif.c: In function ‘ecl_enqueue_wait_for_events’:
cl_nif.c:3878: warning: ‘clEnqueueWaitForEvents’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1225)
cl_nif.c: In function ‘ecl_enqueue_barrier’:
cl_nif.c:4492: warning: ‘clEnqueueBarrier’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1228)
gcc -c -o ../obj/debug/32/cl_hash.o -Ddebug -DDEBUG -g -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m32 -DWORDSIZE=32 -DDARWIN -no-cpp-precomp cl_hash.c
gcc -m32 -bundle -flat_namespace -undefined suppress -o ../lib/debug/32/cl_nif.so ../obj/debug/32/cl_nif.o ../obj/debug/32/cl_hash.o -framework OpenCL
./configure --with-wordsize=64
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for socketpair... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking size of char... 1
checking size of short... 2
checking size of int... 4
checking size of long... 8
checking size of long long... 8
checking size of void *... 8
checking size of size_t... 8
configure: Size void 8
configure: creating ./config.status
config.status: creating config.64.build
config.status: creating config.64.h
make nif TYPE=release WORDSIZE=64
gcc -c -o ../obj/release/64/cl_nif.o -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m64 -DWORDSIZE=64 -DDARWIN -no-cpp-precomp cl_nif.c
cl_nif.c: In function ‘ecl_create_image2d’:
cl_nif.c:2909: warning: ‘clCreateImage2D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1204)
cl_nif.c: In function ‘ecl_create_image3d’:
cl_nif.c:2975: warning: ‘clCreateImage3D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1216)
cl_nif.c: In function ‘ecl_unload_compiler’:
cl_nif.c:3313: warning: ‘clUnloadCompiler’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1231)
cl_nif.c: In function ‘ecl_enqueue_marker’:
cl_nif.c:3851: warning: ‘clEnqueueMarker’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1220)
cl_nif.c: In function ‘ecl_enqueue_wait_for_events’:
cl_nif.c:3878: warning: ‘clEnqueueWaitForEvents’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1225)
cl_nif.c: In function ‘ecl_enqueue_barrier’:
cl_nif.c:4492: warning: ‘clEnqueueBarrier’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1228)
gcc -c -o ../obj/release/64/cl_hash.o -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m64 -DWORDSIZE=64 -DDARWIN -no-cpp-precomp cl_hash.c
gcc -m64 -bundle -flat_namespace -undefined suppress -o ../lib/release/64/cl_nif.so ../obj/release/64/cl_nif.o ../obj/release/64/cl_hash.o -framework OpenCL
make nif TYPE=debug WORDSIZE=64
gcc -c -o ../obj/debug/64/cl_nif.o -Ddebug -DDEBUG -g -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m64 -DWORDSIZE=64 -DDARWIN -no-cpp-precomp cl_nif.c
cl_nif.c: In function ‘ecl_create_image2d’:
cl_nif.c:2909: warning: ‘clCreateImage2D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1204)
cl_nif.c: In function ‘ecl_create_image3d’:
cl_nif.c:2975: warning: ‘clCreateImage3D’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1216)
cl_nif.c: In function ‘ecl_unload_compiler’:
cl_nif.c:3313: warning: ‘clUnloadCompiler’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1231)
cl_nif.c: In function ‘ecl_enqueue_marker’:
cl_nif.c:3851: warning: ‘clEnqueueMarker’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1220)
cl_nif.c: In function ‘ecl_enqueue_wait_for_events’:
cl_nif.c:3878: warning: ‘clEnqueueWaitForEvents’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1225)
cl_nif.c: In function ‘ecl_enqueue_barrier’:
cl_nif.c:4492: warning: ‘clEnqueueBarrier’ is deprecated (declared at /System/Library/Frameworks/OpenCL.framework/Headers/cl.h:1228)
gcc -c -o ../obj/debug/64/cl_hash.o -Ddebug -DDEBUG -g -Wall -Wextra -Wswitch-default -Wswitch-enum -D_THREAD_SAFE -D_REENTRANT -fno-common -I/usr/local/Cellar/erlang/R15B02/lib/erlang/usr/include -O3 -fPIC -m64 -DWORDSIZE=64 -DDARWIN -no-cpp-precomp cl_hash.c
gcc -m64 -bundle -flat_namespace -undefined suppress -o ../lib/debug/64/cl_nif.so ../obj/debug/64/cl_nif.o ../obj/debug/64/cl_hash.o -framework OpenCL
(cd src; make all)
erlc -o ../ebin cl.erl
erlc -o ../ebin clu.erl
sed -e 's;%VSN%;1.1;' cl.app.src > ../ebin/cl.app

how to set Local to a value equivalent to C 'NULL' in enqueue_nd_range_kernel function?

Hi,

I was wondering how to set the value of 'Local' argument to C equivalent of 'NULL' in function 'cl:enqueue_nd_range_kernel'. Essentially I want to let underlying OpenCL implementation to decide how work-items get distributed across work-groups.

This is in accordance with OpenCL spec for 'clEnqueueNDRangeKernel' function which states that:

"local_work_size can also be a NULL value in which case the OpenCL implementation will determine how to be break the global work-items into appropriate work-group instances."

The full details of the spec can be found at:
http://www.khronos.org/registry/cl/sdk/1.1/docs/man/xhtml/clEnqueueNDRangeKernel.html

http://www.khronos.org/registry/cl/sdk/1.2/docs/man/xhtml/clEnqueueNDRangeKernel.html

I tried passing empty list '[]' as the value for 'Local' argument however it resulted in badarg error.

Any help will be much appreciated.

Thanks,

Murali

`rebar compile` doesn't create `cl_drv.so` file

Running rebar compile doesn't compile native code in the same way sa make does.

Running rebar clean compile does create priv/cl_drv.so, but cl app expect it to be under lib/{release,debug}/{32,64}.

I think the more standard way is to have everything under priv.

[cl (zvi_rebar_getdeps_220112)]$ make clean
(cd c_src; make clean)
make[1]: Entering directory `/home/zvi/ws/cl/c_src'
make clean_internal TYPE=release WORDSIZE=32
make[2]: Entering directory `/home/zvi/ws/cl/c_src'
rm -f ../obj/release/32/*.o
rm -f ../lib/release/32/*.so
make[2]: Leaving directory `/home/zvi/ws/cl/c_src'
make clean_internal TYPE=debug   WORDSIZE=32
make[2]: Entering directory `/home/zvi/ws/cl/c_src'
rm -f ../obj/debug/32/*.o
rm -f ../lib/debug/32/*.so
make[2]: Leaving directory `/home/zvi/ws/cl/c_src'
make clean_internal TYPE=release WORDSIZE=64
make[2]: Entering directory `/home/zvi/ws/cl/c_src'
rm -f ../obj/release/64/*.o
rm -f ../lib/release/64/*.so
make[2]: Leaving directory `/home/zvi/ws/cl/c_src'
make clean_internal TYPE=debug   WORDSIZE=64
make[2]: Entering directory `/home/zvi/ws/cl/c_src'
rm -f ../obj/debug/64/*.o
rm -f ../lib/debug/64/*.so
make[2]: Leaving directory `/home/zvi/ws/cl/c_src'
make[1]: Leaving directory `/home/zvi/ws/cl/c_src'
(cd src; make clean)
make[1]: Entering directory `/home/zvi/ws/cl/src'
rm -f ../ebin/cl.beam ../ebin/clu.beam
make[1]: Leaving directory `/home/zvi/ws/cl/src'
[cl (zvi_rebar_getdeps_220112)]$ rebar compile
==> cl (compile)
Compiled src/clu.erl
Compiled src/cl.erl
[cl (zvi_rebar_getdeps_220112)]$ rebar clean compile
==> cl (clean)
==> cl (compile)
Compiled src/clu.erl
Compiled src/cl.erl
Compiling c_src/cl_hash.c
Compiling c_src/cl_nif.c

cl_drv.so under priv created:

[cl (zvi_rebar_getdeps_220112)]$ ls priv/
cl_drv.so

but all the other folders are empty:

[cl (zvi_rebar_getdeps_220112)]$ ls {lib,obj}/*/*
lib/debug/32:

lib/debug/64:

lib/release/32:

lib/release/64:

obj/debug/32:

obj/debug/64:

obj/release/32:

obj/release/64:
[cl (zvi_rebar_getdeps_220112)]$ 

enqueue_copy_image has the wrong arity

I'm working on an Elixir wrapper for this NIF (complete with typespecs, docs, etc available from within the Elixir REPL and Hex docs) and have run into an arity mismatch. enqueue_copy_image/6 should actually be enqueue_copy_image/7 according to the OpenCL 1.0 spec and the actual NIF implementation. On the NIF binding there appears to be only a source origin list provided, where there should also be a dest origin list.

Forked and updating the code, will put in a PR once completed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.