2010-04-18 19:33:18 -04:00
|
|
|
! Copyright (C) 2010 Doug Coleman.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2010-04-19 01:46:03 -04:00
|
|
|
USING: alien.c-types alien.strings cuda cuda.memory cuda.syntax
|
|
|
|
destructors io io.encodings.utf8 kernel locals math sequences ;
|
2010-04-18 21:52:09 -04:00
|
|
|
IN: cuda.demos.hello-world
|
2010-04-18 19:33:18 -04:00
|
|
|
|
2010-04-18 21:52:09 -04:00
|
|
|
CUDA-LIBRARY: hello vocab:cuda/demos/hello-world/hello.ptx
|
2010-04-18 19:33:18 -04:00
|
|
|
|
|
|
|
CUDA-FUNCTION: helloWorld ( char* string-ptr ) ;
|
|
|
|
|
|
|
|
:: cuda-hello-world ( -- )
|
2010-04-19 01:46:03 -04:00
|
|
|
T{ launcher { device 0 } } [
|
2010-04-23 14:57:35 -04:00
|
|
|
"Hello World!" [ - ] map-index host>device &dispose :> str
|
2010-04-18 19:33:18 -04:00
|
|
|
|
2010-04-23 14:57:35 -04:00
|
|
|
str { 6 1 1 } { 2 1 } 2<<< helloWorld
|
2010-04-18 19:33:18 -04:00
|
|
|
|
2010-04-19 01:46:03 -04:00
|
|
|
str device>host utf8 alien>string print
|
2010-04-18 19:33:18 -04:00
|
|
|
] with-cuda ;
|
|
|
|
|
|
|
|
MAIN: cuda-hello-world
|