在 CentOS 7 中实现 MPI 发送/接收时出错
我正在编译这个 MPI 程序,但它给了我 15 个错误,我不知道问题是什么。我到处寻找解决方案但一无所获。我的代码如下,我使用 CentOS 7。我可以编译并运行 OPENMPI 中的其他示例,但这个示例给了我错误。
import mpi.*;
class Hello3 {
static public void main(String[] args) {
MPI.Init(args) ;
int myrank = MPI.COMM_WORLD.getRank();
if(myrank == 0) {
char[] message = “Hello, there”.toCharArray();
MPI.COMM_WORLD.send(message, 0, message.length, MPI.CHAR, 1, 99);
}
else {
char[] message = new char [20];
MPI.COMM_WORLD.recv(message, 0, 20, MPI.CHAR, 0, 99) ;
System.out.println(“received:” + new String(message) + “:”);
}
MPI.Finalize();
}
如果尝试编译它,我会收到以下错误:
[centos@localhost Downloads]$ mpijavac hello3.java
hello3.java:8: error: illegal character: '\u201c'
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: not a statement
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: ';' expected
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: illegal character: '\u201d'
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: not a statement
char[] message = “Hello, there”.toCharArray();
^
hello3.java:15: error: illegal character: '\u201c'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: ';' expected
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal start of expression
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal character: '\u201d'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal character: '\u201c'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: not a statement
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal start of expression
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal character: '\u201d'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal start of expression
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:18: error: reached end of file while parsing
}
^
15 errors
[centos@localhost Downloads]$
有人能帮助我吗?
I am compiling this MPI program but it is giving me 15 errors and I cannot really what the problems are. I have searched for solutions everywhere but found nothing. My code is as follows and I using CentOS 7. I am able to compile and run other examples from OPENMPI but this one is giving me errors.
import mpi.*;
class Hello3 {
static public void main(String[] args) {
MPI.Init(args) ;
int myrank = MPI.COMM_WORLD.getRank();
if(myrank == 0) {
char[] message = “Hello, there”.toCharArray();
MPI.COMM_WORLD.send(message, 0, message.length, MPI.CHAR, 1, 99);
}
else {
char[] message = new char [20];
MPI.COMM_WORLD.recv(message, 0, 20, MPI.CHAR, 0, 99) ;
System.out.println(“received:” + new String(message) + “:”);
}
MPI.Finalize();
}
If try to compile this, I get the following errors:
[centos@localhost Downloads]$ mpijavac hello3.java
hello3.java:8: error: illegal character: '\u201c'
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: not a statement
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: ';' expected
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: illegal character: '\u201d'
char[] message = “Hello, there”.toCharArray();
^
hello3.java:8: error: not a statement
char[] message = “Hello, there”.toCharArray();
^
hello3.java:15: error: illegal character: '\u201c'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: ';' expected
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal start of expression
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal character: '\u201d'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal character: '\u201c'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: not a statement
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal start of expression
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal character: '\u201d'
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:15: error: illegal start of expression
System.out.println(“received:” + new String(message) + “:”);
^
hello3.java:18: error: reached end of file while parsing
}
^
15 errors
[centos@localhost Downloads]$
Is anyone able to help me please?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论