cuda.devices: factor "context-device cuda-device-properties" into a "context-device-properties" word

db4
Joe Groff 2010-05-16 17:15:11 -07:00
parent a7b5957f6d
commit e286a8daef
1 changed files with 5 additions and 2 deletions

View File

@ -70,6 +70,9 @@ IN: cuda.devices
: up/i ( x y -- z ) : up/i ( x y -- z )
[ 1 - + ] keep /i ; inline [ 1 - + ] keep /i ; inline
: context-device-properties ( -- props )
context-device cuda-device-properties ; inline
:: (distribute-jobs) ( job-count per-job-shared max-shared-size max-block-size :: (distribute-jobs) ( job-count per-job-shared max-shared-size max-block-size
-- grid-size block-size per-block-shared ) -- grid-size block-size per-block-shared )
per-job-shared [ max-block-size ] [ max-shared-size swap /i max-block-size min ] if-zero per-job-shared [ max-block-size ] [ max-shared-size swap /i max-block-size min ] if-zero
@ -81,6 +84,6 @@ IN: cuda.devices
grid-size block-size per-block-shared ; inline grid-size block-size per-block-shared ; inline
: distribute-jobs ( job-count per-job-shared -- launcher ) : distribute-jobs ( job-count per-job-shared -- launcher )
context-device cuda-device-properties context-device-properties
[ sharedMemPerBlock>> ] [ maxThreadsDim>> first ] bi [ sharedMemPerBlock>> ] [ maxThreadsPerBlock>> ] bi
(distribute-jobs) 3<<< ; inline (distribute-jobs) 3<<< ; inline