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();
   // }
   // }
 }
 /** Stop the executors and clean memory on registered CUObject */
 public static synchronized void freeMemory() {
   for (CudaEngine ce : cudaEngines.values()) {
     ce.freeCUObjectsMemory();
   }
 }