Forward CUDA printf output to the MATLAB console

1 回表示 (過去 30 日間)
Oliver Woodford
Oliver Woodford 2014 年 6 月 4 日
コメント済み: Thomas Pohl 2017 年 10 月 2 日
I am wrapping CUDA code in a mex file. I have printfs in my CUDA kernel, and I want to see the output from those printfs, ideally in the MATLAB console, but at least somewhere.
Just calling printf, whether within a CUDA kernel or in a normal C/C++ file (avoiding mexPrintf) doesn't get output to the MATLAB console or to the program output window of an attached debugger such as Visual Studio. Perhaps it's just a question of piping stdout somewhere.
Please note that using mexPrintf is not an option here - it won't work in the CUDA kernel. Please also note that I don't have any add-on toolboxes.

採用された回答

Oliver Woodford
Oliver Woodford 2014 年 6 月 5 日
There might be a way to redirect output from stdout in a mex file ( see this question ), but I haven't been able to get it to work on Windows yet.
What I was able to use was the old cuPrintf code which came before the CUDA printf, and is still available in the CUDA SDK sample "simplePrintf", and redirect the output to a file.
  1 件のコメント
Thomas Pohl
Thomas Pohl 2017 年 10 月 2 日
How did you do the redirection to a file? I managed to call cuPrintf inside the kernel but I cannot find the output it creates in Visual Studio.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGPU Computing についてさらに検索

タグ

製品

Community Treasure Hunt

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

Start Hunting!

Translated by