private synchronized void shutdown() { if (!exe.isShutdown()) { freeCUObjectsMemory(); } exe.shutdown(); try { System.err.println( "cuda device " + Id + " freed ? " + exe.awaitTermination(10, TimeUnit.SECONDS)); } catch (InterruptedException e) { e.printStackTrace(); } }
/** Stop the executors and clean memory on registered CUObject */ public static synchronized void freeMemory() { for (CudaEngine ce : cudaEngines.values()) { ce.freeCUObjectsMemory(); } }