我是 MPI 的新手,并使用 C 语言编写了以下程序。我想设置我的数组,而不是使用指针,如下所示。我的第一个数组元素读取正确,之后,它不会读取数组元素。你能告诉我这是否不是使用分散和收集的正确方法
以下是我得到的结果:
$ mpicc test.c -o test
$ mpirun -np 4 test
1. Processor 0 has data 0 1 2 3
2. Processor 0 has data 0
3. Processor 0 doubling the data, now has 5
2. Processor 1 has data 32767
3. Processor 1 doubling the data, now has 5
2. Processor 2 has data -437713961
3. Processor 2 doubling the data, now has 5
2. Processor 3 has data 60
3. Processor 3 doubling …
Run Code Online (Sandbox Code Playgroud)