Parallel programming in Java -
How can we do parallel programming in Java? Is there any special framework for this? How can we do the stuff?
I will tell you what I want, I think that I am developing a web crawler, there is a lot of crawl on its website from the Internet, crawling a system will not make things work Appropriate, so we need 1000 systems to work, if this is the case then can I implement parallel computing? Can you give me a proper example?
1 Import MPI. *; 2 3 / ** 4 * Compiled: Impl Ment Specific 5. Execute: Impression Specific. 6 * / 7 8 Public Class {9 10 Public Stable Zero Main (String [] Send ARG) Exception {11 12 MPI.Init (args) throws; 13 14 integer rank = MPI Comm_World Rank (); // Existing Process: 15 Integer Size = MPI .comm_word. (); Total number of 16 processes; 17 18 Intestate buffer [] = New int [10]; 19 int lane = 1; 20 int datatobresent = 99; 21 into tag = 100; 22 23 if (rank == 0) {24 25 buffer [0] = dataty Basement; 26 peer = 1; 27 MPI.COMM_WORLD.Send (buffer, 0, lane, MPIINT, peer, tag); 28 System.out.println ("Process & lt;" + Rank + "& gt;" + 29 "A message has been sent for the process & lt;" + + + + + + "+" "& gt;); 30 31} and if (rank == 1) {32 33 peer = 0; 34 Status Status = MPI Commm_WireLD RECEV (buffer, 0, buffer length, 35MPI, peer, tag); 36 System.out.printLN ("Process and Lt;" + + Rank + "& gt; One Message \ n" + 37 "\ tdata <" + Buffer [0] + "& gt; \ n" + 38 " \ Tsource & lt; "+ status.source +" & gt; \ n "+ 39" \ ttag & lt; "+ status.tag +" & gt; \ n "+ 40" \ tcount & lt; "+ status .count + "& gt;"); 41 42} 43 44 MPI Finalize (); 45 46} 47 48} One of the most common tasks provided by messaging libraries such as MPS Express is point-to-point communication support among one of the implementation processes. In this context, two processes related to the same communicator (for example, MPI Comm_WORLD Communicator) can communicate with each other by sending and receiving messages. A version of the Send () method is used to send messages from the sender process. On the other hand, the message sent by the reverse process is obtained using a type of RVCV () method. Both the sender and the receiver specify a tag that is used to match the incoming messages from the receiver. Using the MP12 External Library to program the Line 12, using the MPIInte (Args) method, its rank and MPI size. COMM_WORLD Communicator Both processes are called an integer array of length 18, which is called buffer on line 18. Sender Process-Rank Returns the value of 10 to 0-stores in the first element of the msg sar. A type of Send () method is used to send an element of message ARAC to the receiver process.
Send Sender Process to Line 27 () method is called. The first three logic related ones are being sent to dispatch data! AR-bu! After er ar-fiistic logic, there is 0 (o! Set) and 1 (count). The data being sent is of the MPI.INT type and the destination is 1 (peer variable); The fourth and fifth arguments for datatype and destination transmission () method are specific. The last and the sixth logic tag variable is. A tag is used to identify messages in the recipient party, a message tag is a specific message identifying specifically the specific messenger. On the other hand receiver process (rank 1) receives the message using the blocking method.
Comments
Post a Comment