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
10 QUALIFIED-WITH: alien.c-types c
13 TUPLE: cuda-error code ;
15 : cuda-error ( code -- )
16 dup CUDA_SUCCESS = [ drop ] [ \ cuda-error boa throw ] if ;
18 : cuda-version ( -- n )
19 c:int <c-object> [ cuDriverGetVersion cuda-error ] keep c:int c:deref ;
22 0 cuInit cuda-error ; inline