1#![cfg_attr(
2 not(feature = "agave-unstable-api"),
3 deprecated(
4 since = "3.1.0",
5 note = "This crate has been marked for formal inclusion in the Agave Unstable API. From \
6 v4.0.0 onward, the `agave-unstable-api` crate feature must be specified to \
7 acknowledge use of an interface that may break without warning."
8 )
9)]
10#![cfg_attr(feature = "frozen-abi", feature(min_specialization))]
11pub mod cuda_runtime;
12pub mod data_budget;
13pub mod deduper;
14pub mod discard;
15pub mod packet;
16pub mod perf_libs;
17pub mod recycler;
18pub mod recycler_cache;
19pub mod sigverify;
20#[cfg(feature = "dev-context-only-utils")]
21pub mod test_tx;
22pub mod thread;
23
24#[macro_use]
25extern crate log;
26
27#[cfg(test)]
28#[macro_use]
29extern crate assert_matches;
30
31#[macro_use]
32extern crate solana_metrics;
33
34#[cfg_attr(feature = "frozen-abi", macro_use)]
35#[cfg(feature = "frozen-abi")]
36extern crate solana_frozen_abi_macro;
37
38fn is_rosetta_emulated() -> bool {
39 #[cfg(target_os = "macos")]
40 {
41 use std::str::FromStr;
42 std::process::Command::new("sysctl")
43 .args(["-in", "sysctl.proc_translated"])
44 .output()
45 .map_err(|_| ())
46 .and_then(|output| String::from_utf8(output.stdout).map_err(|_| ()))
47 .and_then(|stdout| u8::from_str(stdout.trim()).map_err(|_| ()))
48 .map(|enabled| enabled == 1)
49 .unwrap_or(false)
50 }
51 #[cfg(not(target_os = "macos"))]
52 {
53 false
54 }
55}
56
57pub fn report_target_features() {
58 warn!(
59 "CUDA is {}abled",
60 if crate::perf_libs::api().is_some() {
61 "en"
62 } else {
63 "dis"
64 }
65 );
66
67 if !is_rosetta_emulated() {
71 #[cfg(all(
72 any(target_arch = "x86", target_arch = "x86_64"),
73 build_target_feature_avx
74 ))]
75 {
76 if is_x86_feature_detected!("avx") {
77 info!("AVX detected");
78 } else {
79 error!(
80 "Incompatible CPU detected: missing AVX support. Please build from source on \
81 the target"
82 );
83 std::process::abort();
84 }
85 }
86
87 #[cfg(all(
88 any(target_arch = "x86", target_arch = "x86_64"),
89 build_target_feature_avx2
90 ))]
91 {
92 if is_x86_feature_detected!("avx2") {
93 info!("AVX2 detected");
94 } else {
95 error!(
96 "Incompatible CPU detected: missing AVX2 support. Please build from source on \
97 the target"
98 );
99 std::process::abort();
100 }
101 }
102 }
103}