]> gitweb.factorcode.org Git - factor.git/blob - extra/cuda/cuda.factor
change ERROR: words from throw-foo back to foo.
[factor.git] / extra / cuda / cuda.factor
1 ! Copyright (C) 2010 Doug Coleman.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: accessors alien alien.data alien.parser alien.strings
4 alien.syntax arrays assocs byte-arrays classes.struct
5 combinators continuations cuda.ffi
6 destructors fry init io io.backend io.encodings.string
7 io.encodings.utf8 kernel lexer locals macros math math.parser
8 namespaces opengl.gl.extensions parser prettyprint quotations
9 sequences words ;
10 QUALIFIED-WITH: alien.c-types c
11 IN: cuda
12
13 ERROR: cuda-error-state code ;
14
15 : cuda-error ( code -- )
16     dup CUDA_SUCCESS = [ drop ] [ cuda-error-state ] if ;
17
18 : cuda-version ( -- n )
19     { c:int } [ cuDriverGetVersion cuda-error ] with-out-parameters ;
20
21 : init-cuda ( -- )
22     0 cuInit cuda-error ; inline