Blame view
src/MiorLauncher2.java
1.72 KB
89f70c1ec import current mc... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
import mcmas.core.MCMCommandQueue; import mcmas.core.MCMCommandQueueProperty; import mcmas.core.MCMContext; import mcmas.core.MCMDevice; import mior.model.MiorSimulation; import mior.model.dist.IMiorDistribution; import mior.model.dist.LinearDistribution; public class MiorLauncher2 extends Thread { private final int nbExecutions; private final MCMContext context; private final MCMDevice device; public MiorLauncher2(int nbExecutions, MCMContext context, MCMDevice device) { this.nbExecutions = nbExecutions; this.context = context; this.device = device; } @Override public void run() { MiorSimulation [] simulations = new MiorSimulation[nbExecutions]; MCMCommandQueue queue = context.createCommandQueue(device, MCMCommandQueueProperty.ENABLE_PROFILING, MCMCommandQueueProperty.ENABLE_OOO_MODE ); IMiorDistribution dist = new LinearDistribution(38, 310, 0.3); for (int i = 0; i < simulations.length; i++) { simulations[i] = new MiorSimulation(38, 310, 100, dist); } for (int i = 0; i < simulations.length; i++) { simulations[i].execute(context, queue); } queue.finish(); } public static void main(String[] args) { final int nbThreads = 10; final Thread [] threads = new Thread[nbThreads]; final MCMContext context = new MCMContext(); int nbDevices = context.getDevices().length; for (int i = 0; i < nbThreads; i++) { threads[i] = new MiorLauncher2(10 , context, context.getDevices()[i % nbDevices]); } for (int i = 0; i < nbThreads; i++) { threads[i].start(); } for (int i = 0; i < nbThreads; i++) { try { threads[i].join(); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } } |