1 year ago
#382573
JustWantToLearn
Errors in implementing MPI send/receive in CentOS 7
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?
java
arrays
compiler-errors
mpi
0 Answers
Your Answer