2010-04-18 19:33:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! Copyright (C) 2010 Doug Coleman.
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								! See http://factorcode.org/license.txt for BSD license.
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-20 17:32:35 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								USING: accessors alien.c-types alien.strings byte-arrays cuda
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-20 17:51:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								cuda.contexts cuda.devices cuda.libraries cuda.memory cuda.syntax
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								destructors io io.encodings.string io.encodings.utf8 kernel locals
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								math math.parser namespaces sequences strings ;
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 21:52:09 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								IN: cuda.demos.hello-world
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:33:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-20 20:56:20 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								CUDA-LIBRARY: hello cuda32 vocab:cuda/demos/hello-world/hello.ptx
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:33:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								CUDA-FUNCTION: helloWorld ( char* string-ptr ) ;
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-23 15:27:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								: cuda-hello-world ( -- )
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-15 14:45:02 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    init-cuda
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-23 15:27:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    [
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-03 21:18:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								        [
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-15 14:45:02 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            context-device number>string
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-03 21:18:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            "CUDA device " ": " surround write
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								            "Hello World!" >byte-array [ - ] map-index host>device &cuda-free
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:33:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-20 17:51:47 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            [ { 2 1 } { 6 1 1 } <grid> helloWorld ]
							 | 
						
					
						
							
								
									
										
										
										
											2010-05-03 21:18:10 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								            [ 12 device>host >string print ] bi
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								        ] with-destructors
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-23 15:27:19 -04:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    ] with-each-cuda-device ;
							 | 
						
					
						
							
								
									
										
										
										
											2010-04-18 19:33:18 -04:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								MAIN: cuda-hello-world
							 |