]> gitweb.factorcode.org Git - factor.git/commitdiff
cuda.utils: add "sync-context" word
authorJoe Groff <arcata@gmail.com>
Mon, 10 May 2010 22:06:15 +0000 (15:06 -0700)
committerJoe Groff <arcata@gmail.com>
Mon, 10 May 2010 22:06:15 +0000 (15:06 -0700)
extra/cuda/utils/utils.factor

index 269ebbe401659cf94b1171f23e533a756feb529c..2f5b03642c8a8cdf3f9713cd37e6d4570a2ce52b 100644 (file)
@@ -21,7 +21,7 @@ ERROR: throw-cuda-error n ;
     dup CUDA_SUCCESS = [ drop ] [ throw-cuda-error ] if ;
 
 : init-cuda ( -- )
-    0 cuInit cuda-error ;
+    0 cuInit cuda-error ; inline
 
 : cuda-version ( -- n )
     int <c-object> [ cuDriverGetVersion cuda-error ] keep *int ;
@@ -40,55 +40,58 @@ ERROR: throw-cuda-error n ;
 
 : create-context ( flags device -- context )
     [ CUcontext <c-object> ] 2dip
-    [ cuCtxCreate cuda-error ] 3keep 2drop *void* ;
+    [ cuCtxCreate cuda-error ] 3keep 2drop *void* ; inline
 
-: destroy-context ( context -- ) cuCtxDestroy cuda-error ;
+: sync-context ( -- )
+    cuCtxSynchronize cuda-error ; inline
 
-: launch-function* ( function -- ) cuLaunch cuda-error ;
+: destroy-context ( context -- ) cuCtxDestroy cuda-error ; inline
 
-: launch-function ( -- ) cuda-function get cuLaunch cuda-error ;
+: launch-function* ( function -- ) cuLaunch cuda-error ; inline
+
+: launch-function ( -- ) cuda-function get cuLaunch cuda-error ; inline
 
 : cuda-int* ( function offset value -- )
-    cuParamSeti cuda-error ;
+    cuParamSeti cuda-error ; inline
 
 : cuda-int ( offset value -- )
-    [ cuda-function get ] 2dip cuda-int* ;
+    [ cuda-function get ] 2dip cuda-int* ; inline
 
 : cuda-float* ( function offset value -- )
-    cuParamSetf cuda-error ;
+    cuParamSetf cuda-error ; inline
 
 : cuda-float ( offset value -- )
-    [ cuda-function get ] 2dip cuda-float* ;
+    [ cuda-function get ] 2dip cuda-float* ; inline
 
 : cuda-vector* ( function offset ptr n -- )
-    cuParamSetv cuda-error ;
+    cuParamSetv cuda-error ; inline
 
 : cuda-vector ( offset ptr n -- )
-    [ cuda-function get ] 3dip cuda-vector* ;
+    [ cuda-function get ] 3dip cuda-vector* ; inline
 
 : param-size* ( function n -- )
-    cuParamSetSize cuda-error ;
+    cuParamSetSize cuda-error ; inline
 
 : param-size ( n -- )
-    [ cuda-function get ] dip param-size* ;
+    [ cuda-function get ] dip param-size* ; inline
 
 : launch-function-grid* ( function width height -- )
-    cuLaunchGrid cuda-error ;
+    cuLaunchGrid cuda-error ; inline
 
 : launch-function-grid ( width height -- )
     [ cuda-function get ] 2dip
-    cuLaunchGrid cuda-error ;
+    cuLaunchGrid cuda-error ; inline
 
 : function-block-shape* ( function x y z -- )
-    cuFuncSetBlockShape cuda-error ;
+    cuFuncSetBlockShape cuda-error ; inline
 
 : function-block-shape ( x y z -- )
     [ cuda-function get ] 3dip
-    cuFuncSetBlockShape cuda-error ;
+    cuFuncSetBlockShape cuda-error ; inline
 
 : function-shared-size* ( function n -- )
-    cuFuncSetSharedSize cuda-error ;
+    cuFuncSetSharedSize cuda-error ; inline
 
 : function-shared-size ( n -- )
     [ cuda-function get ] dip
-    cuFuncSetSharedSize cuda-error ;
+    cuFuncSetSharedSize cuda-error ; inline