]> gitweb.factorcode.org Git - factor.git/blob - extra/cuda/cuda.factor
Remove <uint> *uint and friends. Hopefully remove the last usages of these words
[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 TUPLE: cuda-error code ;
14
15 : cuda-error ( code -- )
16     dup CUDA_SUCCESS = [ drop ] [ \ cuda-error boa throw ] if ;
17
18 : cuda-version ( -- n )
19     c:int <c-object> [ cuDriverGetVersion cuda-error ] keep c:int c:deref ;
20
21 : init-cuda ( -- )
22     0 cuInit cuda-error ; inline
23