質問編集履歴

5

誤字

2020/09/22 08:12

投稿

physics303
physics303

スコア89

test CHANGED
File without changes
test CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
  int main(int argc, char* argv[]){
44
44
 
45
- int rank = atoi( argv[1] )
45
+ int rank = atoi( argv[1] );
46
46
 
47
47
  hogehoge
48
48
 

4

コードの全容を入力

2020/09/22 08:12

投稿

physics303
physics303

スコア89

test CHANGED
File without changes
test CHANGED
@@ -57,3 +57,57 @@
57
57
 
58
58
 
59
59
  CentOS, Bash
60
+
61
+
62
+
63
+
64
+
65
+ ### 追記
66
+
67
+ 問題を簡潔にするために,shellscriptの一部だけを取り出していましたが,問題のshellscriptの全容は以下です.以下のコードでrank引数がうまくいかない理由を考えているのです.
68
+
69
+
70
+
71
+ ```shell.sh
72
+
73
+ int cnt=0;
74
+
75
+ int noise_level=0;
76
+
77
+ int dataset_number=0;
78
+
79
+ int sample_size=100;
80
+
81
+ int rank=5;
82
+
83
+ for ((i=0 ; i<sample_size; i++))
84
+
85
+ do
86
+
87
+ for ((j=0 ; j<i+1 ; j++))
88
+
89
+ do
90
+
91
+ cnt=$((cnt+1));
92
+
93
+ if [ $cnt = 75 ]; then
94
+
95
+ wait
96
+
97
+ cnt=0;
98
+
99
+ fi
100
+
101
+ echo $((rank));
102
+
103
+ ./a.out 0 0 opt $i $j $rank&
104
+
105
+ done
106
+
107
+ done
108
+
109
+ wait
110
+
111
+
112
+
113
+ ```

3

文法のミスを指摘

2020/09/22 08:09

投稿

physics303
physics303

スコア89

test CHANGED
File without changes
test CHANGED
@@ -11,6 +11,8 @@
11
11
  int rank=0
12
12
 
13
13
  for ((rank=0 ; rank<10; rank++))
14
+
15
+ do
14
16
 
15
17
  ./a.out $rank&
16
18
 

2

環境追加

2020/09/22 08:01

投稿

physics303
physics303

スコア89

test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,11 @@
47
47
  }
48
48
 
49
49
  ```
50
+
51
+
52
+
53
+ ### 環境
54
+
55
+
56
+
57
+ CentOS, Bash

1

rankの値が0になってしまうことを追記

2020/09/22 07:52

投稿

physics303
physics303

スコア89

test CHANGED
File without changes
test CHANGED
@@ -22,7 +22,7 @@
22
22
 
23
23
 
24
24
 
25
- ただ,これでは正常にrankの値が渡されていないようです.何が問題でしょうか.
25
+ ただ,これでは正常にrankの値が渡されていないようです.プログラムではrankが全て0として処理されているようです.何が問題でしょうか.
26
26
 
27
27
 
28
28