Esempio n. 1
0
 public static synchronized void cuCtxSynchronizeAll() {
   for (CudaEngine ce : cudaEngines.values()) {
     ce.cuCtxSynchronize();
   }
   // List<Future<Void>> futures = new ArrayList<Future<Void>>();
   // for (CudaEngine ce : executors) {
   // futures.add(ce.exe.submit(new Callable<Void>() {
   // @Override
   // public Void call() throws Exception {
   // JCudaDriver.cuCtxSynchronize();
   // return null;
   // }
   //
   // }));
   // }
   // for (Future<Void> future : futures) {
   // try {
   // future.get();
   // } catch (InterruptedException | ExecutionException e) {
   // // TODO Auto-generated catch block
   // e.printStackTrace();
   // }
   // }
 }
Esempio n. 2
0
  @Override
  protected void end() {
    super.end();
    if (timer != null) {
      timer = null; // stops the timer from within its run
    }
    if (isMadkitPropertyTrue(TurtleKit.Option.cuda)) {
      CudaEngine.stop();
      if (logger != null) logger.fine("cuda freed");
    }
    //		pause(10000);

    //		killAgent(model.getEnvironment());
    //		CudaEngine.stop();
    //		sendMessage(
    //				LocalCommunity.NAME,
    //				Groups.SYSTEM,
    //				Organization.GROUP_MANAGER_ROLE,
    //				new KernelMessage(KernelAction.EXIT));//TODO work with AA but this is probably worthless
  }
Esempio n. 3
0
 /** Stop the executors and clean memory on registered CUObject */
 public static synchronized void freeMemory() {
   for (CudaEngine ce : cudaEngines.values()) {
     ce.freeCUObjectsMemory();
   }
 }