1 /* Copyright 2016 The TensorFlow Authors. All Rights Reserved. 2 3 Licensed under the Apache License, Version 2.0 (the "License"); 4 you may not use this file except in compliance with the License. 5 You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9 Unless required by applicable law or agreed to in writing, software 10 distributed under the License is distributed on an "AS IS" BASIS, 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 See the License for the specific language governing permissions and 13 limitations under the License. 14 ==============================================================================*/ 15 16 #ifndef TENSORFLOW_CORE_PLATFORM_CUDA_LIBDEVICE_PATH_H_ 17 #define TENSORFLOW_CORE_PLATFORM_CUDA_LIBDEVICE_PATH_H_ 18 19 #include <vector> 20 #include "tensorflow/core/platform/types.h" 21 22 namespace tensorflow { 23 24 // Returns, in order of preference, potential locations of the root directory of 25 // the CUDA SDK, which contains sub-folders such as bin, lib64, and nvvm. 26 std::vector<string> CandidateCudaRoots(); 27 28 // A convenient wrapper for CandidateCudaRoots, which allows supplying a 29 // preferred location (inserted first in the output vector), and a flag whether 30 // the current working directory should be searched (inserted last). 31 inline std::vector<string> CandidateCudaRoots( 32 string preferred_location, bool use_working_directory = true) { 33 std::vector<string> candidates = CandidateCudaRoots(); 34 if (!preferred_location.empty()) { 35 candidates.insert(candidates.begin(), preferred_location); 36 } 37 38 // "." is our last resort, even though it probably won't work. 39 candidates.push_back("."); 40 41 return candidates; 42 } 43 44 } // namespace tensorflow 45 46 #endif // TENSORFLOW_CORE_PLATFORM_CUDA_LIBDEVICE_PATH_H_ 47