factor/extra/cuda/cuda.factor

23 lines
744 B
Factor
Raw Normal View History

! Copyright (C) 2010 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien alien.data alien.parser alien.strings
alien.syntax arrays assocs byte-arrays classes.struct
2010-05-20 17:32:35 -04:00
combinators continuations cuda.ffi
destructors fry init io io.backend io.encodings.string
io.encodings.utf8 kernel lexer locals macros math math.parser
2010-05-10 20:50:28 -04:00
namespaces opengl.gl.extensions parser prettyprint quotations
2010-05-20 17:32:35 -04:00
sequences words ;
QUALIFIED-WITH: alien.c-types c
IN: cuda
2013-03-24 17:24:21 -04:00
ERROR: cuda-error-state code ;
2010-05-20 17:32:35 -04:00
: cuda-error ( code -- )
dup CUDA_SUCCESS = [ drop ] [ cuda-error-state ] if ;
2010-05-20 17:32:35 -04:00
: cuda-version ( -- n )
{ c:int } [ cuDriverGetVersion cuda-error ] with-out-parameters ;
2010-05-20 17:32:35 -04:00
: init-cuda ( -- )
0 cuInit cuda-error ; inline