
実現したいこと
Visual Studio CodeでCudaプログラミングを実行する
質問
CUDA Toolkitとnvidia-driverをインストールして、
vscodeでcudaプログラミングを書いたテキスト画面で以下のエラーが出ました。
調べたら、vscodeのパスの設定が必要のなのはわかったのですが、どこのパスをどう設定したらわからないため、良いか教えてもらいたいです。
環境
Ubuntu 22.04.2
NVIDIA GeForce RTX 2080
vsCode
その他
OpenACCのプログラムは実行できました。
インストールの参考にしたサイト
https://qiita.com/porizou1/items/74d8264d6381ee2941bd
https://misoji-engineer.com/archives/ubuntu20-04-cuda.html
下記プログラムが書いてあるサイト
https://tech.ckme.co.jp/cuda_first.shtml
発生している問題・エラーメッセージ
vsCode画面でのエラーメッセージ(コンパイル前)
#include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/user1/test_program/sample_cuda.cu).C/C++(1696)
cannot open source file "cutil.h"
コンパイラエラー
/home/user1/test_program/sample_cuda.cu:2:10: fatal error: cutil.h: そのようなファイルやディレクトリはありません
2 | #include <cutil.h> //エラー箇所
| ^~~~~~~~~
compilation terminated.
やってみたこと
以下のプログラムだとvscode内では以下のエラー文(_grobalの部分)が発生していましたが、コンパライルはできました。
this declaration has no storage class or type specifierC/C++(77)
<error-type> global
#include <stdio.h> #include <malloc.h> __global__ void cuda_hello(){ printf("Hello World from GPU!\n"); } int main() { cuda_hello<<<1,1>>>(); return 0; }
該当のソースコード
#include <stdio.h> #include <cutil.h> //エラー箇所 int main( int argc, char** argv) { CUT_DEVICE_INIT(argc, argv); unsigned int timer = 0; CUT_SAFE_CALL( cutCreateTimer( &timer)); CUT_SAFE_CALL( cutStartTimer( timer)); CUT_SAFE_CALL( cutStopTimer( timer)); printf( "Processing time: %f (ms)\n", cutGetTimerValue( timer)); CUT_SAFE_CALL( cutDeleteTimer( timer)); CUT_EXIT(argc, argv); return 0; }


回答1件
あなたの回答
tips
プレビュー