質問編集履歴

3

文章修正

2023/06/18 11:04

投稿

hamua
hamua

スコア2

test CHANGED
File without changes
test CHANGED
@@ -22,7 +22,7 @@
22
22
  https://tech.ckme.co.jp/cuda_first.shtml
23
23
 
24
24
  ### 発生している問題・エラーメッセージ
25
- エラーメッセージ
25
+ vsCode画面でのエラーメッセージ(コンパイル前)
26
26
  #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/user1/test_program/sample_cuda.cu).C/C++(1696)
27
27
  cannot open source file "cutil.h"
28
28
 

2

前提から質問に見出しを変更

2023/06/18 11:03

投稿

hamua
hamua

スコア2

test CHANGED
File without changes
test CHANGED
@@ -1,10 +1,10 @@
1
1
  ### 実現したいこと
2
2
 
3
3
  Visual Studio CodeでCudaプログラミングを実行する
4
- ### 前提
4
+ ### 質問
5
5
 
6
6
  CUDA Toolkitとnvidia-driverをインストールして、
7
- vscodeでcudaプログラミングを実行しようとし際に以下のエラーが出ました。
7
+ vscodeでcudaプログラミングを書いテキスト画面で以下のエラーが出ました。
8
8
  調べたら、vscodeのパスの設定が必要のなのはわかったのですが、どこのパスをどう設定したらわからないため、良いか教えてもらいたいです。
9
9
 
10
10
  ### 環境

1

質問に対する追記と見出しの修正

2023/06/18 10:56

投稿

hamua
hamua

スコア2

test CHANGED
File without changes
test CHANGED
@@ -10,6 +10,7 @@
10
10
  ### 環境
11
11
  Ubuntu 22.04.2
12
12
  NVIDIA GeForce RTX 2080
13
+ vsCode
13
14
 
14
15
  ### その他
15
16
  OpenACCのプログラムは実行できました。
@@ -25,10 +26,32 @@
25
26
  #include errors detected. Please update your includePath. Squiggles are disabled for this translation unit (/home/user1/test_program/sample_cuda.cu).C/C++(1696)
26
27
  cannot open source file "cutil.h"
27
28
 
29
+ コンパイラエラー
30
+ /home/user1/test_program/sample_cuda.cu:2:10: fatal error: cutil.h: そのようなファイルやディレクトリはありません
31
+ 2 | #include <cutil.h> //エラー箇所
32
+ | ^~~~~~~~~
33
+ compilation terminated.
34
+
35
+ ### やってみたこと
36
+ 以下のプログラムだとvscode内では以下のエラー文(_grobalの部分)が発生していましたが、コンパライルはできました。
37
+
38
+ this declaration has no storage class or type specifierC/C++(77)
39
+ <error-type> __global__
40
+ ```
41
+ #include <stdio.h>
42
+ #include <malloc.h>
43
+
44
+ __global__ void cuda_hello(){
45
+ printf("Hello World from GPU!\n");
46
+ }
47
+ int main() {
48
+ cuda_hello<<<1,1>>>();
49
+ return 0;
50
+ }
28
51
  ```
29
52
 
30
53
  ### 該当のソースコード
31
-
54
+ ```
32
55
  #include <stdio.h>
33
56
  #include <cutil.h> //エラー箇所
34
57
 
@@ -46,4 +69,5 @@
46
69
  CUT_EXIT(argc, argv);
47
70
  return 0;
48
71
  }
72
+ ```
49
73