factor/extra/cuda/demos/hello-world/hello-world.factor

21 lines
623 B
Factor
Raw Normal View History

! Copyright (C) 2010 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
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 21:52:09 -04:00
CUDA-LIBRARY: hello vocab:cuda/demos/hello-world/hello.ptx
CUDA-FUNCTION: helloWorld ( char* string-ptr ) ;
:: cuda-hello-world ( -- )
T{ launcher { device 0 } } [
"Hello World!" [ - ] map-index host>device &dispose :> str
str { 6 1 1 } { 2 1 } 2<<< helloWorld
str device>host utf8 alien>string print
] with-cuda ;
MAIN: cuda-hello-world