Detect and print build type. Refs #88

PiperOrigin-RevId: 614906000
This commit is contained in:
Jan Wassenberg 2024-03-11 21:57:35 -07:00 committed by Copybara-Service
parent a9be065c28
commit 0d406061c0
2 changed files with 20 additions and 2 deletions

4
run.cc
View File

@ -66,8 +66,8 @@ void ShowConfig(LoaderArgs& loader, InferenceArgs& inference, AppArgs& app) {
<< std::thread::hardware_concurrency() << std::endl
<< "Instruction set : "
<< hwy::TargetName(hwy::DispatchedTarget()) << " ("
<< hwy::VectorBytes() * 8 << " bits)"
<< "\n"
<< hwy::VectorBytes() * 8 << " bits)" << "\n"
<< "Compiled config : " << CompiledConfig() << "\n"
<< "Weight Type : "
<< gcpp::TypeName(gcpp::WeightT()) << "\n"
<< "EmbedderInput Type : "

View File

@ -36,6 +36,24 @@
namespace gcpp {
static inline const char* CompiledConfig() {
if (HWY_IS_ASAN) {
return "asan";
} else if (HWY_IS_MSAN) {
return "msan";
} else if (HWY_IS_TSAN) {
return "tsan";
#if defined(HWY_IS_UBSAN)
} else if (HWY_IS_UBSAN) {
return "ubsan";
#endif
} else if (HWY_IS_DEBUG_BUILD) {
return "dbg";
} else {
return "opt";
}
}
static inline void PinThreadToCore(size_t cpu_index) {
#if HWY_OS_LINUX
// Forces the thread to run on the logical processor with the same number.