import pl.edu.agh.icsr.lip.*; import mpi.*; import pl.edu.agh.icsr.janet.tools.*; public class Data_ooc_irr { /* ... */ public static void main(String[] args) throws MPIException { /* ... */ Datamap datamap, filetype, memtype; Schedule schedule; IOBufmap bufm; Datamap datamap_irr; MPI.Init(args); LIP.Setup(null, 0); info = new mpi.Info(); rank = LIP.Rank(); size = LIP.Size(); datamap = new Datamap(new Datamap.BlockDistribution(l, l_l), 1, 0); datamap_irr = new Datamap(); datamap_irr.create_hilbert_distribution_ooc(datamap, xfile, yfile, null, l_l, ps, sample, new VDouble(vertex),edge,minedge); |
Calling lip methods in Java also comes naturally by using virtual arrays VDouble with the method subArray to reference a portion of array data. It replaces the pointers that are commonly used in C library calls to pass arrays to functions.
mpi.File file_irr = new mpi.File(); file_irr.open(MPI.COMM_WORLD, "data_irr.file", mpi.File.MODE_RDWR | mpi.File.MODE_CREATE, null); datamap_irr.remap_ooc(datamap,file,file_irr,l_l, ps, MPI.DOUBLE, Datamap.CREATE_LOCAL | Datamap.MOVE_DATA); bufm = new IOBufmap(l_l); schedule = new Schedule(l_l); |
The index layout is encapsulated in the ContIntIndexer class which eliminates the need for using many flags to localize functions, as was the case in C.
LIP.Localize(datamap_irr, new LIP.ContIntIndexer(perm), new LIP.ContIntIndexer(perm_l), 0, schedule); LIP.OOC_Localize(new LIP.ContIntIndexer(perm_l), new LIP.ContIntIndexer(tperm_l), 0, new VDouble(x_l), MPI.DOUBLE, bufm, schedule); /* ... */ LIP.Gather(new VDouble(x_l), new VDouble(x_l).subArray(l_l), MPI.DOUBLE, schedule ); /* irregular loops ... */ LIP.Scatter(new VDouble(x_l).subArray(l_l), new VDouble(x_l), MPI.DOUBLE, schedule, LIP.OP_SUM); schedule.free(); schedule = null; |
Next: Summary
Up: Java Bindings to lip
Previous: Other classes and interfaces
  Contents
Created by Katarzyna Zając