From dca3ce69f81e2a78c2b6650772c04fc98b810ca2 Mon Sep 17 00:00:00 2001
From: Franck Dary <franck.dary@lis-lab.fr>
Date: Fri, 17 Apr 2020 14:18:00 +0200
Subject: [PATCH] Setting cudann bench to true

---
 decoder/src/MacaonDecode.cpp | 2 ++
 trainer/src/MacaonTrain.cpp  | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/decoder/src/MacaonDecode.cpp b/decoder/src/MacaonDecode.cpp
index 2c42868..39a9293 100644
--- a/decoder/src/MacaonDecode.cpp
+++ b/decoder/src/MacaonDecode.cpp
@@ -73,6 +73,8 @@ int MacaonDecode::main()
   bool debug = variables.count("debug") == 0 ? false : true;
   bool printAdvancement = !debug && variables.count("silent") == 0 ? true : false;
 
+  torch::globalContext().setBenchmarkCuDNN(true);
+
   if (dictPaths.empty())
     util::error(fmt::format("no '{}' files were found, and none were given. Has the model been trained yet ?", fmt::format(ReadingMachine::defaultDictFilename, "")));
   if (modelPaths.empty())
diff --git a/trainer/src/MacaonTrain.cpp b/trainer/src/MacaonTrain.cpp
index 72ff743..85c049d 100644
--- a/trainer/src/MacaonTrain.cpp
+++ b/trainer/src/MacaonTrain.cpp
@@ -101,6 +101,8 @@ int MacaonTrain::main()
   bool computeDevScore = variables.count("devScore") == 0 ? false : true;
   auto machineContent = variables["machine"].as<std::string>();
 
+  torch::globalContext().setBenchmarkCuDNN(true);
+
   if (!machineContent.empty())
   {
     std::FILE * file = fopen(machinePath.c_str(), "w");
-- 
GitLab