MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetBinaryDir

Function GetBinaryDir

tensorflow/stream_executor/rocm/rocm_gpu_executor.cc:217–231  ·  view source on GitHub ↗

Returns the path to the running executable. N.B. Derived from //knowledge/smalltalk/background_kb.cc Arg: strip_exe: if true, remove the name of the executable itself from the returned string. Example: calling this from /usr/bin/foo would return /usr/bin.

Source from the content-addressed store, hash-verified

215// returned string. Example: calling this from /usr/bin/foo
216// would return /usr/bin.
217static string GetBinaryDir(bool strip_exe) {
218 char exe_path[PATH_MAX] = {0};
219 PCHECK(readlink("/proc/self/exe", exe_path, sizeof(exe_path) - 1) != -1);
220 // Make sure it's null-terminated:
221 exe_path[sizeof(exe_path) - 1] = 0;
222
223 if (strip_exe) {
224 // The exe is the last component of the path, so remove one component.
225 string ret = exe_path;
226 std::vector<string> components = absl::StrSplit(exe_path, '/');
227 components.pop_back();
228 return absl::StrJoin(components, "/");
229 }
230 return exe_path;
231}
232
233port::Status GpuExecutor::GetKernel(const MultiKernelLoaderSpec& spec,
234 KernelBase* kernel) {

Callers

nothing calls this directly

Calls 1

pop_backMethod · 0.80

Tested by

no test coverage detected