Add parallelization of multiple simulations
This commit is contained in:
parent
4c2d0ccf50
commit
eece2c1d3a
@ -7,6 +7,8 @@ import fr.ntr.scheduler.Scheduler;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.concurrent.ExecutorService;
|
||||||
|
import java.util.concurrent.Executors;
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
@ -26,6 +28,7 @@ public class Main {
|
|||||||
}
|
}
|
||||||
int timeSlotNb = 2;
|
int timeSlotNb = 2;
|
||||||
int subCarrierNb = 100;
|
int subCarrierNb = 100;
|
||||||
|
try(ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors())) {
|
||||||
for(int i = 2; i <= maximumLoad; i += 2) {
|
for(int i = 2; i <= maximumLoad; i += 2) {
|
||||||
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
List<User> users = generateUsers(i, timeSlotNb, subCarrierNb);
|
||||||
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
ResourceBlock[][] frame = new ResourceBlock[timeSlotNb][subCarrierNb];
|
||||||
@ -33,10 +36,10 @@ public class Main {
|
|||||||
// Scheduler scheduler = new ProportionalFair(frame, users);
|
// Scheduler scheduler = new ProportionalFair(frame, users);
|
||||||
Scheduler scheduler = new RoundRobin(frame, users);
|
Scheduler scheduler = new RoundRobin(frame, users);
|
||||||
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
AccessPoint accessPoint = new AccessPoint(scheduler, frame, users, timeSlotNb, subCarrierNb, 0, 50);
|
||||||
accessPoint.startSimulation(numberOfTicks);
|
executor.submit(() -> accessPoint.startSimulation(numberOfTicks));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
} else {
|
||||||
System.err.println("Please give launch arguments");
|
System.err.println("Please give launch arguments");
|
||||||
System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");
|
System.err.println("gradle run --args=\"<number of ticks> <number of users>\"");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
|
Reference in New Issue
Block a user