run4flat / perl-cuda-minimal Goto Github PK
View Code? Open in Web Editor NEWA minimal set of CUDA bindings for Perl.
A minimal set of CUDA bindings for Perl.
~/hack/CUDA-Minimal$ perl Build.PL
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'CUDA-Minimal' version '0.01'
~/hack/CUDA-Minimal$ ./Build
Building CUDA-Minimal
/home/daxim/local/share/perlbrew/perls/gcc46/bin/perl -MExtUtils::nvcc::Backend -eExtUtils::nvcc::Backend::compiler -- -I. -I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE -DXS_VERSION="0.01" -DVERSION="0.01" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -o lib/CUDA/Minimal.o lib/CUDA/Minimal.c
lib/CUDA/Minimal.c(374): error: linkage specification is incompatible with previous "Perl___notused"
(163): here
1 error detected in the compilation of "/tmp/tmpxft_00004081_00000000-6_Minimal.cpp1.ii".
nvcc encountered a problem
error building lib/CUDA/Minimal.o from 'lib/CUDA/Minimal.c' at /home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/ExtUtils/CBuilder/Base.pm line 177.
~/hack/CUDA-Minimal$ /home/daxim/local/share/perlbrew/perls/gcc46/bin/perl -MExtUtils::nvcc::Backend -eExtUtils::nvcc::Backend::compiler -- -v -I. -I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE -DXS_VERSION="0.01" -DVERSION="0.01" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -o lib/CUDA/Minimal.o lib/CUDA/Minimal.c
ExtUtils::nvcc found nvcc args [[-v]], [[-I.]], [[-I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE]], [[-DXS_VERSION=0.01]], [[-DVERSION=0.01]], [[-c]], [[-D_REENTRANT]], [[-D_GNU_SOURCE]], [[-DDEBUGGING]], [[-I/usr/local/include]], [[-D_LARGEFILE_SOURCE]], [[-D_FILE_OFFSET_BITS=64]], [[-O2]], [[-g]], [[-o]], [[lib/CUDA/Minimal.o]]
ExtUtils::nvcc found other args [[-fPIC]], [[-fPIC]], [[-fno-strict-aliasing]], [[-pipe]], [[-fstack-protector]]
ExtUtils::nvcc found source files [[lib/CUDA/Minimal.c]]
Running nvcc with args [[-Xcompiler=-fPIC,-fPIC,-fno-strict-aliasing,-pipe,-fstack-protector]], [[-v]], [[-I.]], [[-I/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE]], [[-DXS_VERSION=0.01]], [[-DVERSION=0.01]], [[-c]], [[-D_REENTRANT]], [[-D_GNU_SOURCE]], [[-DDEBUGGING]], [[-I/usr/local/include]], [[-D_LARGEFILE_SOURCE]], [[-D_FILE_OFFSET_BITS=64]], [[-O2]], [[-g]], [[-o]], [[lib/CUDA/Minimal.o]], [[--x=cu]], [[lib/CUDA/Minimal.c]], [[--compiler-bindir=gcc-4.6]]
#$ _SPACE_=
#$ _CUDART_=cudart
#$ _HERE_=/usr/local/cuda/bin
#$ _THERE_=/usr/local/cuda/bin
#$ _TARGET_SIZE_=64
#$ TOP=/usr/local/cuda/bin/..
#$ LD_LIBRARY_PATH=/usr/local/cuda/bin/../lib:/usr/local/cuda/lib64:/usr/local/cuda/lib:
#$ PATH=/usr/local/cuda/bin/../open64/bin:/usr/local/cuda/bin/../nvvm:/usr/local/cuda/bin:/home/daxim/local/share/perlbrew/bin:/home/daxim/local/share/perlbrew/perls/gcc46/bin:/home/daxim/local/bin:/usr/local/cuda/bin:/opt/kde3/sbin:/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games:/opt/kde3/bin:/usr/lib/mit/bin:/usr/lib/mit/sbin:/usr/sbin:/usr/sbin
#$ INCLUDES="-I/usr/local/cuda/bin/../include"
#$ LIBRARIES= "-L/usr/local/cuda/bin/../lib64" -lcudart
#$ CUDAFE_FLAGS=
#$ OPENCC_FLAGS=
#$ PTXAS_FLAGS=
#$ gcc-4.6 -D__CUDA_ARCH__=100 -E -x c++ -DCUDA_FLOAT_MATH_FUNCTIONS -DCUDA_NO_SM_11_ATOMIC_INTRINSICS -DCUDA_NO_SM_12_ATOMIC_INTRINSICS -DCUDA_NO_SM_13_DOUBLE_INTRINSICS -D__CUDACC__ -D__NVCC__ -fPIC -fPIC -fno-strict-aliasing -pipe -fstack-protector -O2 -I"." -I"/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld/CORE" -I"/usr/local/include" "-I/usr/local/cuda/bin/../include" -D"XS_VERSION=0.01" -D"VERSION=0.01" -D"_REENTRANT" -D"_GNU_SOURCE" -D"DEBUGGING" -D"_LARGEFILE_SOURCE" -D"_FILE_OFFSET_BITS=64" -include "cuda_runtime.h" -m64 -g -o "/tmp/tmpxft_0000408a_00000000-6_Minimal.cpp1.ii" "lib/CUDA/Minimal.c"
#$ cudafe --m64 --gnu_version=40603 -tused --no_remove_unneeded_entities --gen_c_file_name "/tmp/tmpxft_0000408a_00000000-3_Minimal.cudafe1.c" --stub_file_name "/tmp/tmpxft_0000408a_00000000-3_Minimal.cudafe1.stub.c" --gen_device_file_name "/tmp/tmpxft_0000408a_00000000-3_Minimal.cudafe1.gpu" --nv_arch "compute_10" --gen_module_id_file --module_id_file_name "/tmp/tmpxft_0000408a_00000000-2_Minimal.module_id" --include_file_name "tmpxft_0000408a_00000000-1_Minimal.fatbin.c" "/tmp/tmpxft_0000408a_00000000-6_Minimal.cpp1.ii"
lib/CUDA/Minimal.c(374): error: linkage specification is incompatible with previous "Perl___notused"
(163): here
lib/CUDA/Minimal.c(386): error: expected a ")"
2 errors detected in the compilation of "/tmp/tmpxft_0000408a_00000000-6_Minimal.cpp1.ii".
# --error 0x2 --
nvcc encountered a problem
~/hack/CUDA-Minimal$ git log --format=raw | head -n 1
commit 991419acb95d17320f6fdaf203dc7afcbd85ed08
~/hack/CUDA-Minimal$ uname -a
Linux champion 3.4.28-2.20-desktop #1 SMP PREEMPT Tue Jan 29 16:51:37 UTC 2013 (143156b) x86_64 x86_64 x86_64 GNU/Linux
~/hack/CUDA-Minimal$ perl -V
Summary of my perl5 (revision 5 version 16 subversion 2) configuration:
Platform:
osname=linux, osvers=3.4.28-2.20-desktop, archname=x86_64-linux-thread-multi-ld
uname='linux champion 3.4.28-2.20-desktop #1 smp preempt tue jan 29 16:51:37 utc 2013 (143156b) x86_64 x86_64 x86_64 gnulinux '
config_args='-de -Dprefix=/home/daxim/local/share/perlbrew/perls/gcc46 -Dcc=gcc-4.6 -DDEBUGGING -Dusemorebits -Dusethreads [email protected] [email protected] -Accflags=-fPIC -Aeval:scriptdir=/home/daxim/local/share/perlbrew/perls/gcc46/bin'
hint=recommended, useposix=true, d_sigaction=define
useithreads=define, usemultiplicity=define
useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
use64bitint=define, use64bitall=define, uselongdouble=define
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc-4.6', ccflags ='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O2 -g',
cppflags='-D_REENTRANT -D_GNU_SOURCE -fPIC -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include'
ccversion='', gccversion='4.6.3 20120531 [gcc-4_6-branch revision 188067]', gccosandvers=''
intsize=4, longsize=8, ptrsize=8, doublesize=8, byteorder=12345678
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=8, nvtype='long double', nvsize=16, Off_t='off_t', lseeksize=8
alignbytes=16, prototype=define
Linker and Libraries:
ld='gcc-4.6', ldflags =' -fstack-protector -L/usr/local/lib'
libpth=/usr/local/lib /lib/../lib64 /usr/lib/../lib64 /lib /usr/lib /lib64 /usr/lib64 /usr/local/lib64
libs=-lnsl -lndbm -lgdbm -ldb -ldl -lm -lcrypt -lutil -lpthread -lc -lgdbm_compat
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=/lib/libc-2.16.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version='2.16'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
cccdlflags='-fPIC', lddlflags='-shared -O2 -g -L/usr/local/lib -fstack-protector'
Characteristics of this binary (from libperl):
Compile-time options: DEBUGGING HAS_TIMES MULTIPLICITY PERLIO_LAYERS
PERL_DONT_CREATE_GVSV PERL_IMPLICIT_CONTEXT
PERL_MALLOC_WRAP PERL_PRESERVE_IVUV
PERL_TRACK_MEMPOOL USE_64_BIT_ALL USE_64_BIT_INT
USE_ITHREADS USE_LARGE_FILES USE_LOCALE
USE_LOCALE_COLLATE USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC USE_LONG_DOUBLE USE_PERLIO
USE_PERL_ATOF USE_REENTRANT_API
Built under linux
Compiled at Feb 17 2013 18:15:44
%ENV:
PERLBREW_BASHRC_VERSION="0.58"
PERLBREW_HOME="/home/daxim/.perlbrew"
PERLBREW_MANPATH="/home/daxim/local/share/perlbrew/perls/gcc46/man"
PERLBREW_PATH="/home/daxim/local/share/perlbrew/bin:/home/daxim/local/share/perlbrew/perls/gcc46/bin"
PERLBREW_PERL="gcc46"
PERLBREW_ROOT="/home/daxim/local/share/perlbrew"
PERLBREW_VERSION="0.58"
@INC:
/home/daxim/local/share/perlbrew/perls/gcc46/lib/site_perl/5.16.2/x86_64-linux-thread-multi-ld
/home/daxim/local/share/perlbrew/perls/gcc46/lib/site_perl/5.16.2
/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2/x86_64-linux-thread-multi-ld
/home/daxim/local/share/perlbrew/perls/gcc46/lib/5.16.2
.
Hi, I am trying to get perl-CUDA-Minimal up and running. I have CUDA working and can compile all the samples from NVIDIA
I had no problem compiling ExtUtils:nvcc (after I figured out the added path's)
Now I am stuck on "./Build" in this module as it says "Error: no compiler detected to compile 'lib/CUDA/Minimal.c'. Aborting.
The message is no help and I can't find where it is failing in Build so I can try to figure out what it is looking for.
Some idea's would be appreciated.
OH, I am on Fedora 19 if it helps
Haven't looked at Buld.PL for a little bit. It needs to be bumped up to ExtUtils::nvcc v 0.03. It doesn't matter much since only 0.03 is available on CPAN, but it's good to keep the bookkeeping up-to-date.
This is a bug report from Russell Smithies that I received via email.
Hi David,
I've got your example code running on my GPU after a few attempts :-)
This server is running RHEL5 with Perl 5.8.8 so had to build newer Perl from src (5.14.1)
Built and installed run4flat-perl_nvcc-135063b and run4flat-perl-CUDA-Minimal-1c65f6e (no git or external access on this server)
I had a few errors on the test but it installed OK:
[root@hpgpuleft run4flat-perl-CUDA-Minimal-1c65f6e]# ./Build test
t/00_load.t ............... ok
t/Index-Manipulation.t .... ok
t/Memory.t ................ ok
t/Transfer.t .............. ok
t/z_PDL.t ................. ok
t/z_kernel_invocations.t .. 1/28 # Gold gave 524800 and CUDA gave 524800
# Gold gave 524800 and CUDA gave 524800
# Gold gave 0.398780822753906 and CUDA gave 0.398714065551758
# Gold gave 0.398780822753906 and CUDA gave 0.398714065551758
# Gold gave 0.398780822753906 and CUDA gave 0.398709535598755
# Failed test 'PeekAtLastError correctly returns an unspecified launch failure'
# at t/z_kernel_invocations.t line 71.
# 'invalid configuration argument'
# doesn't match '(?^:unspecified)'
# Failed test 'The failing kernel gives an unspecified launch failure'
# at t/z_kernel_invocations.t line 77.
# 'invalid configuration argument'
# doesn't match '(?^:unspecified)'
# Failed test 'Good kernels invoked after a failed kernel launch also fail'
# at t/z_kernel_invocations.t line 84.
# Failed test 'Further kernel invocations return an unspecified launch failure'
# at t/z_kernel_invocations.t line 88.
# 'no error'
# doesn't match '(?^:unspecified)'
# Failed test 'Device resets invalidate previously allocated memory'
# at t/z_kernel_invocations.t line 98.
# Looks like you failed 5 tests of 28.
t/z_kernel_invocations.t .. Dubious, test returned 5 (wstat 1280, 0x500)
Failed 5/28 subtests
Test Summary Report
-------------------
t/z_kernel_invocations.t (Wstat: 1280 Tests: 28 Failed: 5)
Failed tests: 21, 23, 25-26, 28
Non-zero exit status: 5
Files=6, Tests=81, 5 wallclock secs ( 0.03 usr 0.02 sys + 0.29 cusr 4.06 csys = 4.40 CPU)
Result: FAIL
Failed 1/6 test programs. 5/81 subtests failed.
Hey David ... no dice. Looking into it now
Building CUDA-Minimal
/home/kthakore/.perl5/perls/perl-5.12.2/bin/perl5.12.2 -MExtUtils::nvcc::Backend -eExtUtils::nvcc::Backend::compiler -- -I. -I/home/kthakore/.perl5/perls/perl-5.12.2/lib/5.12.2/x86_64-linux-thread-multi/CORE -DXS_VERSION="0.01" -DVERSION="0.01" -fPIC -c -D_REENTRANT -D_GNU_SOURCE -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -I/opt/local/include -O2 -o lib/CUDA/Minimal.o lib/CUDA/Minimal.c
lib/CUDA/Minimal.xs(152): error: identifier "cudaDeviceReset" is undefined
1 error detected in the compilation of "/tmp/tmpxft_00000f4a_00000000-4_Minimal.cpp1.ii".
nvcc encountered a problem
error building lib/CUDA/Minimal.o from 'lib/CUDA/Minimal.c' at /home/kthakore/.perl5/perls/perl-5.12.2/lib/5.12.2/ExtUtils/CBuilder/Base.pm line 112.
When running 'perl Build.PL' I got the following errors:
/usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/../../../../x86_64-pc-linux-gnu/bin/ld: unrecognised emulation mode: arch=native Supported emulations: elf_x86_64 elf_i386 i386linux elf_l1om collect2: ld returned 1 exit status nvcc encountered a problem
Is there any way to work around this issue? Running with
config => {ExtUtils::nvcc::MB('verbose')},
I get the folowing output
Making verbose ExtUtils::nvcc found nvcc args [[-I/usr/lib64/perl5/5.12.3/x86_64-linux/CORE]], [[-c]], [[-D_LARGEFILE_SOURCE]], [[-D_FILE_OFFSET_BITS=64]], [[-O2]], [[-o]], [[compilet-yvJH2.o]] ExtUtils::nvcc found other args [[-fPIC]], [[-fno-strict-aliasing]], [[-pipe]], [[-pipe]], [[-march=native]] ExtUtils::nvcc found source files [[compilet-yvJH2.c]] Running nvcc with args [[-Xcompiler=-fPIC,-fno-strict-aliasing,-pipe,-pipe,-march=native]], [[-I/usr/lib64/perl5/5.12.3/x86_64-linux/CORE]], [[-c]], [[-D_LARGEFILE_SOURCE]], [[-D_FILE_OFFSET_BITS=64]], [[-O2]], [[-o]], [[compilet-yvJH2.o]], [[--x=cu]], [[compilet-yvJH2.c]] Making verbose ExtUtils::nvcc found nvcc args [[-shared]], [[-O2]], [[-o]], [[compilet-yvJH2.so]] ExtUtils::nvcc found other args [[-pipe]], [[-march=native]], [[-Wl,-O1]], [[-Wl,--as-needed]] ExtUtils::nvcc found source files [[compilet-yvJH2.o]] Running nvcc with args [[-Xlinker=-pipe,-march=native,-Wl,-O1,-Wl,--as-needed]], [[-shared]], [[-O2]], [[-o]], [[compilet-yvJH2.so]], [[compilet-yvJH2.o]] /usr/lib/gcc/x86_64-pc-linux-gnu/4.4.5/../../../../x86_64-pc-linux-gnu/bin/ld: unrecognised emulation mode: arch=native Supported emulations: elf_x86_64 elf_i386 i386linux elf_l1om collect2: ld returned 1 exit status nvcc encountered a problem
Running tests (./Build test
) after build results in
Failed 1/6 test programs. 1/66 subtests failed.
Examining failing test gives the following result:
$ ./Build test --verbose=1 --test_files t/z_kernel_invocations.t [...] ok 26 - Further kernel invocations return an unspecified launch failure not ok 27 - Kernel invocations after DeviceReset succeed # Failed test 'Kernel invocations after DeviceReset succeed' # at t/z_kernel_invocations.t line 93. ok 28 - Device resets invalidate previously allocated memory # Looks like you failed 1 test of 28. Dubious, test returned 1 (wstat 256, 0x100) Failed 1/28 subtests [...]
This is Linux 2.6.36-gentoo-r4, on x86_64, with perl v5.12.3, Cuda compilation tools, release 4.0, V0.2.1221, CUDA 4.0.13, with GeForce GTX 480 (2.0 device).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.