How to define varying size of inputs for codegen?

조회 수: 1 (최근 30일)
rokP
rokP 2017년 11월 2일
I'd like to make mex file executable on GPU and hence am studying the "GPU Code Generation: The Mandelbrot Set" demo. The problem is how to properly define the varying size of the inputs, i.e. maxIterations,xGrid and yGrid of the function mandelbrot_count when calling codegen:
codegen -config cfg -args {maxIterations,xGrid,yGrid} mandelbrot_count
In the demo example the inputs size is fixed and if you change the inputs sizes, the mandelbrot_count_mex throws an error. I did a research and found the function coder.typeof to define the type of inputs. So, when defining, e.g. xGrid = coder.typeof(0, [inf inf]) which defines both dimensions of the xGrid as varying, then it solves my problem but the code becomes much slower then when the input size is defined as fixed. Is there any other solution to the problem please?

답변 (0개)

카테고리

Help CenterFile Exchange에서 Get Started with GPU Coder에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by