Add global setting control TF32 execution
This commit is contained in:
parent
32d63d0a3e
commit
d2afc9ce83
|
@ -938,6 +938,13 @@ cc_library(
|
|||
alwayslink = 1,
|
||||
)
|
||||
|
||||
cc_library(
|
||||
name = "tf32_utils",
|
||||
srcs = ["tf32_utils.cc"],
|
||||
hdrs = ["tf32_utils.h"],
|
||||
copts = tf_copts(),
|
||||
)
|
||||
|
||||
tf_cc_tests(
|
||||
name = "low_level_library_tests",
|
||||
size = "small",
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#include "tensorflow/core/platform/tf32_utils.h"
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
// TODO(nluehr): enable tf32 execution by default after TF32 Ampere testing.
|
||||
static bool tf32_enabled = false;
|
||||
|
||||
void allow_tf32_execution(bool allow) { tf32_enabled = allow; }
|
||||
|
||||
bool tf32_execution_allowed() { return tf32_enabled; }
|
||||
|
||||
} // namespace tensorflow
|
|
@ -0,0 +1,27 @@
|
|||
/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef TENSORFLOW_CORE_PLATFORM_TF32_UTILS_H_
|
||||
#define TENSORFLOW_CORE_PLATFORM_TF32_UTILS_H_
|
||||
|
||||
namespace tensorflow {
|
||||
|
||||
void allow_tf32_execution(bool allow);
|
||||
|
||||
bool tf32_execution_allowed();
|
||||
|
||||
} // namespace tensorflow
|
||||
|
||||
#endif // TENSORFLOW_CORE_PLATFORM_TF32_UTILS_H_
|
Loading…
Reference in New Issue