Added logging while returning number of GPUs
@@ -4,6 +4,8 @@ import eu.modernmt.decoder.opennmt.OpenNMTException;
import eu.modernmt.decoder.opennmt.memory.ScoreEntry;
import eu.modernmt.model.Sentence;
import eu.modernmt.model.Translation;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.io.Closeable;
import java.io.File;
@@ -14,11 +16,18 @@ import java.io.IOException;
*/
public interface ExecutionQueue extends Closeable {
+ Logger logger = LogManager.getLogger(ExecutionQueue.class);
+
static ExecutionQueue newInstance(File home, File model) throws OpenNMTException {
try {
int gpus = MultiGPUsExecutionQueue.getNumberOfGPUs();
+
+ if (gpus < 1)
+ logger.warn("Unable to retrieve number of GPUs, result is " + gpus);
+
return newInstance(home, model, gpus);
} catch (IOException e) {
+ logger.error("Unable to retrieve number of GPUs, failed to execute command. Falling back to SingletonExecutionQueue", e);
return newInstance(home, model, 1);
}
}
