2019-11-04 20:13:43 -08:00
|
|
|
pub mod cuda_runtime;
|
2021-09-21 08:49:41 -07:00
|
|
|
pub mod data_budget;
|
2023-01-25 13:34:53 -08:00
|
|
|
pub mod deduper;
|
2022-05-22 18:40:33 -07:00
|
|
|
pub mod discard;
|
2019-11-06 10:52:30 -08:00
|
|
|
pub mod packet;
|
2019-11-04 20:13:43 -08:00
|
|
|
pub mod perf_libs;
|
|
|
|
pub mod recycler;
|
2019-11-15 12:16:56 -08:00
|
|
|
pub mod recycler_cache;
|
2019-11-06 10:52:30 -08:00
|
|
|
pub mod sigverify;
|
|
|
|
pub mod test_tx;
|
2021-10-26 18:07:37 -07:00
|
|
|
pub mod thread;
|
2019-11-04 20:13:43 -08:00
|
|
|
|
2019-11-07 19:48:33 -08:00
|
|
|
#[macro_use]
|
|
|
|
extern crate lazy_static;
|
|
|
|
|
2019-11-04 20:13:43 -08:00
|
|
|
#[macro_use]
|
|
|
|
extern crate log;
|
2019-11-06 10:52:30 -08:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
#[macro_use]
|
|
|
|
extern crate matches;
|
|
|
|
|
|
|
|
#[macro_use]
|
|
|
|
extern crate solana_metrics;
|
2021-10-09 15:57:17 -07:00
|
|
|
|
|
|
|
fn is_rosetta_emulated() -> bool {
|
|
|
|
#[cfg(target_os = "macos")]
|
|
|
|
{
|
|
|
|
use std::str::FromStr;
|
|
|
|
std::process::Command::new("sysctl")
|
2022-09-29 06:32:24 -07:00
|
|
|
.args(["-in", "sysctl.proc_translated"])
|
2021-10-09 15:57:17 -07:00
|
|
|
.output()
|
|
|
|
.map_err(|_| ())
|
|
|
|
.and_then(|output| String::from_utf8(output.stdout).map_err(|_| ()))
|
|
|
|
.and_then(|stdout| u8::from_str(stdout.trim()).map_err(|_| ()))
|
|
|
|
.map(|enabled| enabled == 1)
|
|
|
|
.unwrap_or(false)
|
|
|
|
}
|
|
|
|
#[cfg(not(target_os = "macos"))]
|
|
|
|
{
|
|
|
|
false
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
pub fn report_target_features() {
|
|
|
|
warn!(
|
|
|
|
"CUDA is {}abled",
|
|
|
|
if crate::perf_libs::api().is_some() {
|
|
|
|
"en"
|
|
|
|
} else {
|
|
|
|
"dis"
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
// Validator binaries built on a machine with AVX support will generate invalid opcodes
|
|
|
|
// when run on machines without AVX causing a non-obvious process abort. Instead detect
|
|
|
|
// the mismatch and error cleanly.
|
|
|
|
if !is_rosetta_emulated() {
|
2021-12-01 20:41:53 -08:00
|
|
|
#[cfg(all(
|
|
|
|
any(target_arch = "x86", target_arch = "x86_64"),
|
|
|
|
build_target_feature_avx
|
|
|
|
))]
|
2021-10-09 15:57:17 -07:00
|
|
|
{
|
|
|
|
if is_x86_feature_detected!("avx") {
|
|
|
|
info!("AVX detected");
|
|
|
|
} else {
|
|
|
|
error!(
|
|
|
|
"Incompatible CPU detected: missing AVX support. Please build from source on the target"
|
|
|
|
);
|
|
|
|
std::process::abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-12-01 20:41:53 -08:00
|
|
|
#[cfg(all(
|
|
|
|
any(target_arch = "x86", target_arch = "x86_64"),
|
|
|
|
build_target_feature_avx2
|
|
|
|
))]
|
2021-10-09 15:57:17 -07:00
|
|
|
{
|
|
|
|
if is_x86_feature_detected!("avx2") {
|
|
|
|
info!("AVX2 detected");
|
|
|
|
} else {
|
|
|
|
error!(
|
|
|
|
"Incompatible CPU detected: missing AVX2 support. Please build from source on the target"
|
|
|
|
);
|
|
|
|
std::process::abort();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|