Compile the .cu file with a relative pathname instead of absolute

db4
Doug Coleman 2010-04-23 15:06:43 -05:00
parent b8c10dc2cd
commit 8323332838
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1 @@
Doug Coleman

View File

@ -0,0 +1,31 @@
! Copyright (C) 2010 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays combinators.smart io.backend io.directories
io.launcher io.pathnames kernel locals math sequences splitting
system ;
IN: cuda.nvcc
HOOK: nvcc-path os ( -- path )
M: object nvcc-path "nvcc" ;
M: macosx nvcc-path "/usr/local/cuda/bin/nvcc" ;
: cu>ptx ( path -- path' )
".cu" ?tail drop ".ptx" append ;
: nvcc-command ( path -- seq )
[
[ nvcc-path "--ptx" "-o" ] dip
[ cu>ptx ] [ file-name ] bi
] output>array ;
ERROR: nvcc-failed n path ;
:: compile-cu ( path -- path' )
path normalize-path :> path2
path2 parent-directory [
path2 nvcc-command
run-process wait-for-process [ path2 nvcc-failed ] unless-zero
path2 cu>ptx
] with-directory ;