2010-04-13 05:30:31 -04:00
|
|
|
! Copyright (C) 2010 Doug Coleman.
|
|
|
|
! See http://factorcode.org/license.txt for BSD license.
|
2010-04-18 19:33:18 -04:00
|
|
|
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
|
2010-04-23 15:27:19 -04:00
|
|
|
destructors fry init io io.backend io.encodings.string
|
2010-04-19 01:46:03 -04:00
|
|
|
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 ;
|
2010-05-07 21:02:42 -04:00
|
|
|
QUALIFIED-WITH: alien.c-types c
|
2010-04-13 05:30:31 -04:00
|
|
|
IN: cuda
|
|
|
|
|
2013-03-24 17:24:21 -04:00
|
|
|
ERROR: cuda-error-state code ;
|
2010-04-14 22:09:16 -04:00
|
|
|
|
2010-05-20 17:32:35 -04:00
|
|
|
: cuda-error ( code -- )
|
2015-08-13 19:13:05 -04:00
|
|
|
dup CUDA_SUCCESS = [ drop ] [ cuda-error-state ] if ;
|
2010-05-14 18:59:31 -04:00
|
|
|
|
2010-05-20 17:32:35 -04:00
|
|
|
: cuda-version ( -- n )
|
2010-12-25 19:54:45 -05:00
|
|
|
{ c:int } [ cuDriverGetVersion cuda-error ] with-out-parameters ;
|
2010-04-18 19:33:18 -04:00
|
|
|
|
2010-05-20 17:32:35 -04:00
|
|
|
: init-cuda ( -- )
|
|
|
|
0 cuInit cuda-error ; inline
|