62 #include <boost/filesystem.hpp>
67 std::vector<std::string> &
split(
const std::string &
s,
char delim, std::vector<std::string> &elems)
69 std::stringstream ss(
s);
71 while (std::getline(ss, item, delim))
73 elems.push_back(item);
116 std::string list_file = (path +
"/list.txt");
117 std::ifstream lcfg(list_file.c_str());
126 while (std::getline(lcfg, line))
128 if (line.find(
',') == std::string::npos)
135 std::vector<std::string> def;
139 if (def[0] == def[2] && def[1].
length() > 0 && def[2].
length() > 0)
169 static void findLibs(
const boost::filesystem::path &path, std::vector<std::string> &libs)
171 if (boost::filesystem::exists(path) && boost::filesystem::is_directory(path))
173 boost::filesystem::recursive_directory_iterator end_itr;
174 for (boost::filesystem::recursive_directory_iterator itr(path); itr != end_itr; ++itr)
176 if (boost::filesystem::is_regular_file(itr->status()))
178 std::string name(itr->path().filename().string());
179 if (name.compare(0, 3,
"lib") == 0 && name.compare(name.length() - 3, 3,
".so") == 0)
181 libs.push_back(itr->path().string());
209 std::string etiss_path =
etiss::cfg().
get<std::string>(
"etiss_wd",
"");
210 std::vector<std::string> lib_dirs{ std::string(
"ArchImpl"), std::string(
"JITImpl"), std::string(
"PluginImpl") };
211 if (!etiss_path.empty())
213 std::vector<std::string> libs;
214 for (
auto itr = lib_dirs.begin(); itr != lib_dirs.end(); ++itr)
216 findLibs(boost::filesystem::path(etiss_path + *itr), libs);
218 for (
auto itr = libs.begin(); itr != libs.end(); ++itr)
220 size_t path_end = itr->rfind(
'/');
221 etiss::loadLibrary(itr->substr(0, path_end), itr->substr(path_end + 4, itr->length() - path_end - 7));
bool etiss_preload_libraries
This flag indicate whether the preloading of the libraries has been executed or not.
static void findLibs(const boost::filesystem::path &path, std::vector< std::string > &libs)
Find all dynamically linked libraries in a folder and its subfolders.
static bool loadLibraryList(const std::string &path)
Load libraries specified in a list.txt file.
Header file of the ETISS library.
__device__ __2f16 float bool s
T get(const std::string &key, T default_, bool *default_used=0)
template function to read the value of a configuration key.
contains defines to configure ETISS.
bool loadLibrary(std::string path, std::string name)
Load a library.
void preloadLibraries()
Search and try to load libraries.
Page Table Entry (PTE) defines the composition of Page Frame Number (PFN) and relavant flags.
std::list< std::string > split(const std::string &str, std::function< size_t(const std::string &, size_t, size_t &)> findsplit)
std::string installDir()
Get ETISS installation directory.
Configuration & cfg(const std::string &cfgName)
Get reference of the global ETISS configuration object.
void log(Verbosity level, std::string msg)
write log message at the given level.
float __ovld __cnfn length(float p)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)