convert_iter_to_stream.br

来自「用于GPU通用计算的编程语言BrookGPU 0.4」· BR 代码 · 共 31 行

BR
31
字号
// convert_iter_to_stream.br// Tests automatic conversion of iterators to streams// when an interator is passed to a kernel argument// that expects a stream.#include <stdio.h>kernel void copy( float input<>, out float output<> ) {	output = input;}int main(){	iter float iterator< 100 > = iter( 0.0f, 25.0f );	float stream< 100 >;	float stream_data[100];	int i, j;		copy( iterator, stream );	streamWrite( stream, stream_data );		for( i = 0; i < 10; i++ ) {		for( j = 0; j < 10; j++ ) {			printf( "%6.3f ", stream_data[10*i+j] );		}		printf( "\n" );	}		return 0;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?