Reformat imports to a consistent style for imports
rustfmt.toml configuration: imports_granularity = "One" group_imports = "One"
This commit is contained in:
@ -5,23 +5,26 @@
|
||||
// copies from host memory to GPU memory unless the memory is page-pinned and
|
||||
// cannot be paged to disk. The cuda driver provides these interfaces to pin and unpin memory.
|
||||
|
||||
use crate::perf_libs;
|
||||
use crate::recycler::{RecyclerX, Reset};
|
||||
use rand::seq::SliceRandom;
|
||||
use rand::Rng;
|
||||
use rayon::prelude::*;
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::slice::{Iter, IterMut, SliceIndex};
|
||||
use std::sync::Weak;
|
||||
|
||||
use std::os::raw::c_int;
|
||||
use {
|
||||
crate::{
|
||||
perf_libs,
|
||||
recycler::{RecyclerX, Reset},
|
||||
},
|
||||
rand::{seq::SliceRandom, Rng},
|
||||
rayon::prelude::*,
|
||||
std::{
|
||||
ops::{Index, IndexMut},
|
||||
os::raw::c_int,
|
||||
slice::{Iter, IterMut, SliceIndex},
|
||||
sync::Weak,
|
||||
},
|
||||
};
|
||||
|
||||
const CUDA_SUCCESS: c_int = 0;
|
||||
|
||||
fn pin<T>(_mem: &mut Vec<T>) {
|
||||
if let Some(api) = perf_libs::api() {
|
||||
use std::ffi::c_void;
|
||||
use std::mem::size_of;
|
||||
use std::{ffi::c_void, mem::size_of};
|
||||
|
||||
let ptr = _mem.as_mut_ptr();
|
||||
let size = _mem.capacity().saturating_mul(size_of::<T>());
|
||||
|
@ -1,9 +1,11 @@
|
||||
//! The `packet` module defines data structures and methods to pull data from the network.
|
||||
use crate::{cuda_runtime::PinnedVec, recycler::Recycler};
|
||||
use bincode::config::Options;
|
||||
use serde::Serialize;
|
||||
pub use solana_sdk::packet::{Meta, Packet, PACKET_DATA_SIZE};
|
||||
use std::net::SocketAddr;
|
||||
use {
|
||||
crate::{cuda_runtime::PinnedVec, recycler::Recycler},
|
||||
bincode::config::Options,
|
||||
serde::Serialize,
|
||||
std::net::SocketAddr,
|
||||
};
|
||||
|
||||
pub const NUM_PACKETS: usize = 1024 * 8;
|
||||
|
||||
@ -131,10 +133,14 @@ where
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::signature::{Keypair, Signer};
|
||||
use solana_sdk::system_transaction;
|
||||
use {
|
||||
super::*,
|
||||
solana_sdk::{
|
||||
hash::Hash,
|
||||
signature::{Keypair, Signer},
|
||||
system_transaction,
|
||||
},
|
||||
};
|
||||
|
||||
#[test]
|
||||
fn test_to_packets() {
|
||||
|
@ -1,14 +1,18 @@
|
||||
use core::ffi::c_void;
|
||||
use dlopen::symbor::{Container, SymBorApi, Symbol};
|
||||
use dlopen_derive::SymBorApi;
|
||||
use log::*;
|
||||
use solana_sdk::packet::Packet;
|
||||
use std::env;
|
||||
use std::ffi::OsStr;
|
||||
use std::fs;
|
||||
use std::os::raw::{c_int, c_uint};
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::Once;
|
||||
use {
|
||||
core::ffi::c_void,
|
||||
dlopen::symbor::{Container, SymBorApi, Symbol},
|
||||
dlopen_derive::SymBorApi,
|
||||
log::*,
|
||||
solana_sdk::packet::Packet,
|
||||
std::{
|
||||
env,
|
||||
ffi::OsStr,
|
||||
fs,
|
||||
os::raw::{c_int, c_uint},
|
||||
path::{Path, PathBuf},
|
||||
sync::Once,
|
||||
},
|
||||
};
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Elems {
|
||||
|
@ -1,7 +1,10 @@
|
||||
use rand::{thread_rng, Rng};
|
||||
use std::sync::atomic::AtomicBool;
|
||||
use std::sync::atomic::{AtomicUsize, Ordering};
|
||||
use std::sync::{Arc, Mutex, Weak};
|
||||
use {
|
||||
rand::{thread_rng, Rng},
|
||||
std::sync::{
|
||||
atomic::{AtomicBool, AtomicUsize, Ordering},
|
||||
Arc, Mutex, Weak,
|
||||
},
|
||||
};
|
||||
|
||||
// A temporary burst in the workload can cause a large number of allocations,
|
||||
// after which they will be recycled and still reside in memory. If the number
|
||||
@ -179,9 +182,7 @@ impl<T: Default + Reset> RecyclerX<T> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::packet::PacketsRecycler;
|
||||
use std::iter::repeat_with;
|
||||
use {super::*, crate::packet::PacketsRecycler, std::iter::repeat_with};
|
||||
|
||||
impl Reset for u64 {
|
||||
fn reset(&mut self) {
|
||||
|
@ -1,6 +1,4 @@
|
||||
use crate::cuda_runtime::PinnedVec;
|
||||
use crate::recycler::Recycler;
|
||||
use crate::sigverify::TxOffset;
|
||||
use crate::{cuda_runtime::PinnedVec, recycler::Recycler, sigverify::TxOffset};
|
||||
|
||||
#[derive(Default, Clone)]
|
||||
pub struct RecyclerCache {
|
||||
|
@ -4,22 +4,27 @@
|
||||
//! to the GPU.
|
||||
//!
|
||||
|
||||
use crate::cuda_runtime::PinnedVec;
|
||||
use crate::packet::{Packet, Packets};
|
||||
use crate::perf_libs;
|
||||
use crate::recycler::Recycler;
|
||||
use rayon::ThreadPool;
|
||||
use solana_metrics::inc_new_counter_debug;
|
||||
use solana_rayon_threadlimit::get_thread_count;
|
||||
use solana_sdk::hash::Hash;
|
||||
use solana_sdk::message::{MESSAGE_HEADER_LENGTH, MESSAGE_VERSION_PREFIX};
|
||||
use solana_sdk::pubkey::Pubkey;
|
||||
use solana_sdk::short_vec::decode_shortu16_len;
|
||||
use solana_sdk::signature::Signature;
|
||||
#[cfg(test)]
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use std::convert::TryFrom;
|
||||
use std::mem::size_of;
|
||||
use {
|
||||
crate::{
|
||||
cuda_runtime::PinnedVec,
|
||||
packet::{Packet, Packets},
|
||||
perf_libs,
|
||||
recycler::Recycler,
|
||||
},
|
||||
rayon::ThreadPool,
|
||||
solana_metrics::inc_new_counter_debug,
|
||||
solana_rayon_threadlimit::get_thread_count,
|
||||
solana_sdk::{
|
||||
hash::Hash,
|
||||
message::{MESSAGE_HEADER_LENGTH, MESSAGE_VERSION_PREFIX},
|
||||
pubkey::Pubkey,
|
||||
short_vec::decode_shortu16_len,
|
||||
signature::Signature,
|
||||
},
|
||||
std::{convert::TryFrom, mem::size_of},
|
||||
};
|
||||
|
||||
// Representing key tKeYE4wtowRb8yRroZShTipE18YVnqwXjsSAoNsFU6g
|
||||
const TRACER_KEY_BYTES: [u8; 32] = [
|
||||
@ -587,16 +592,21 @@ pub fn make_packet_from_transaction(tx: Transaction) -> Packet {
|
||||
#[cfg(test)]
|
||||
#[allow(clippy::integer_arithmetic)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::packet::{Packet, Packets};
|
||||
use crate::sigverify;
|
||||
use crate::sigverify::PacketOffsets;
|
||||
use crate::test_tx::{test_multisig_tx, test_tx, vote_tx};
|
||||
use bincode::{deserialize, serialize};
|
||||
use solana_sdk::instruction::CompiledInstruction;
|
||||
use solana_sdk::message::{Message, MessageHeader};
|
||||
use solana_sdk::signature::{Keypair, Signature};
|
||||
use solana_sdk::transaction::Transaction;
|
||||
use {
|
||||
super::*,
|
||||
crate::{
|
||||
packet::{Packet, Packets},
|
||||
sigverify::{self, PacketOffsets},
|
||||
test_tx::{test_multisig_tx, test_tx, vote_tx},
|
||||
},
|
||||
bincode::{deserialize, serialize},
|
||||
solana_sdk::{
|
||||
instruction::CompiledInstruction,
|
||||
message::{Message, MessageHeader},
|
||||
signature::{Keypair, Signature},
|
||||
transaction::Transaction,
|
||||
},
|
||||
};
|
||||
|
||||
const SIG_OFFSET: usize = 1;
|
||||
|
||||
@ -1084,10 +1094,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_get_checked_scalar() {
|
||||
solana_logger::setup();
|
||||
use curve25519_dalek::scalar::Scalar;
|
||||
use rand::{thread_rng, Rng};
|
||||
use rayon::prelude::*;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use {
|
||||
curve25519_dalek::scalar::Scalar,
|
||||
rand::{thread_rng, Rng},
|
||||
rayon::prelude::*,
|
||||
std::sync::atomic::{AtomicU64, Ordering},
|
||||
};
|
||||
|
||||
if perf_libs::api().is_none() {
|
||||
return;
|
||||
@ -1124,10 +1136,12 @@ mod tests {
|
||||
#[test]
|
||||
fn test_ge_small_order() {
|
||||
solana_logger::setup();
|
||||
use curve25519_dalek::edwards::CompressedEdwardsY;
|
||||
use rand::{thread_rng, Rng};
|
||||
use rayon::prelude::*;
|
||||
use std::sync::atomic::{AtomicU64, Ordering};
|
||||
use {
|
||||
curve25519_dalek::edwards::CompressedEdwardsY,
|
||||
rand::{thread_rng, Rng},
|
||||
rayon::prelude::*,
|
||||
std::sync::atomic::{AtomicU64, Ordering},
|
||||
};
|
||||
|
||||
if perf_libs::api().is_none() {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user