Skip to content

Commit

Permalink
fix/test/serial: more #[serial_test::serial] tags
Browse files Browse the repository at this point in the history
  • Loading branch information
drahnr committed Mar 28, 2020
1 parent beda2b0 commit 7f3a5a2
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 39 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions coaster-nn/src/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,14 +199,14 @@ macro_rules! test_cuda {

#[cfg(feature = "cuda")]
#[test]
#[serial]
#[serial_test::serial]
fn $f32_name() {
$test_name::<f32, _>(crate::tests::get_cuda_backend())
}

#[cfg(feature = "cuda")]
#[test]
#[serial]
#[serial_test::serial]
fn $f64_name() {
$test_name::<f64, _>(crate::tests::get_cuda_backend())
}
Expand Down Expand Up @@ -234,7 +234,7 @@ macro_rules! test_cross {
($test_name:ident, $f32_name:ident) => {
#[cfg(all(feature = "native",feature = "cuda"))]
#[test]
#[serial]
#[serial_test::serial]
fn $f32_name() {
$test_name::<_, _>(crate::tests::get_native_backend(), crate::tests::get_cuda_backend())
}
Expand Down
1 change: 1 addition & 0 deletions coaster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ compiletest_rs = { version = "0.4", optional = true }
[dev-dependencies]
rand = "0.7"
coaster-nn = { version = "0.4" }
serial_test = "0.4"

[features]
default = ["native", "cuda"]
Expand Down
2 changes: 1 addition & 1 deletion coaster/tests/backend_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ mod backend_spec {
use crate::co::*;

#[test]
#[serial]
#[serial_test::serial]
fn it_can_create_default_backend() {
assert!(Backend::<Cuda>::default().is_ok());
}
Expand Down
12 changes: 6 additions & 6 deletions coaster/tests/framework_cuda_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@ mod framework_cuda_spec {
use crate::co::frameworks::cuda::memory::*;

#[test]
#[serial]
#[serial_test::serial]
fn it_works() {
let frm = Cuda::new();
println!("{:?}", frm.hardwares());
}

#[test]
#[serial]
#[serial_test::serial]
fn it_creates_context() {
let frm = Cuda::new();
let hardwares = &frm.hardwares()[0..1];
println!("{:?}", frm.new_device(hardwares));
}

#[test]
#[serial]
#[serial_test::serial]
#[allow(unused_must_use)]
fn it_allocates_memory() {
let vec_a = vec![0isize, 1, 2, -3, 4, 5, 6, 7];
Expand All @@ -34,7 +34,7 @@ mod framework_cuda_spec {
}

#[test]
#[serial]
#[serial_test::serial]
#[allow(unused_must_use)]
// Create a lot of new CUDA devices, tests for correct dropping of device
fn it_creates_a_lot_of_devices() {
Expand All @@ -45,7 +45,7 @@ mod framework_cuda_spec {
}

#[test]
#[serial]
#[serial_test::serial]
#[allow(unused_must_use)]
// Allocate 128mb blocks with dropping them in between, tests for correct freeing of memory
fn it_allocates_4gb_memory_same_device() {
Expand All @@ -58,7 +58,7 @@ mod framework_cuda_spec {
}

#[test]
#[serial]
#[serial_test::serial]
fn it_can_synchronize_context() {
let backend = Backend::<Cuda>::default().unwrap();
backend.synchronize().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions coaster/tests/shared_memory_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ mod shared_memory_spec {
}

#[test]
#[serial]
#[serial_test::serial]
#[cfg(feature = "cuda")]
fn it_creates_new_shared_memory_for_cuda() {
let ntv = Cuda::new();
Expand Down Expand Up @@ -62,7 +62,7 @@ mod shared_memory_spec {
}

#[test]
#[serial]
#[serial_test::serial]
#[cfg(feature = "cuda")]
fn it_syncs_from_native_to_cuda_and_back() {
let cu = Cuda::new();
Expand Down
1 change: 1 addition & 0 deletions juice/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ capnpc = "0.12"

[dev-dependencies]
env_logger = "0.6"
serial_test = "0.4"

[features]
default = ["native", "cuda"]
Expand Down
2 changes: 1 addition & 1 deletion juice/src/layers/common/convolution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ mod tests {
use crate::co::*;

#[test]
#[serial]
#[serial_test::serial]
#[cfg(feature="cuda")]
fn correct_shapes() {
let cfg = ConvolutionConfig {
Expand Down
4 changes: 2 additions & 2 deletions juice/src/layers/common/rnn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ mod tests {
}

#[test]
#[serial]
#[serial_test::serial]
#[cfg(feature = "cuda")]
fn rnn_create_layer() {
let cfg = RnnConfig {
Expand Down Expand Up @@ -397,7 +397,7 @@ mod tests {
}

#[test]
#[serial]
#[serial_test::serial]
#[cfg(feature = "cuda")]
fn rnn_forward_pass() {
let backend: Backend<Cuda> = cuda_backend();
Expand Down
6 changes: 3 additions & 3 deletions rcublas/cublas/src/api/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,21 +166,21 @@ mod test {
use super::super::PointerMode;

#[test]
#[serial]
#[serial_test::serial]
fn create_context() {
Context::new().unwrap();
}

#[test]
#[serial]
#[serial_test::serial]
fn default_pointer_mode_is_host() {
let ctx = Context::new().unwrap();
let mode = ctx.pointer_mode().unwrap();
assert_eq!(PointerMode::Host, mode);
}

#[test]
#[serial]
#[serial_test::serial]
fn can_set_pointer_mode() {
let mut context = Context::new().unwrap();
// set to Device
Expand Down
14 changes: 7 additions & 7 deletions rcublas/cublas/src/api/level1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_asum() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down Expand Up @@ -330,7 +330,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_axpy() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down Expand Up @@ -367,7 +367,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_copy() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down Expand Up @@ -399,7 +399,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_dot() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down Expand Up @@ -436,7 +436,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_nrm2() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down Expand Up @@ -468,7 +468,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_scal() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down Expand Up @@ -499,7 +499,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_swap() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down
2 changes: 1 addition & 1 deletion rcublas/cublas/src/api/level3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn use_cuda_memory_for_gemm() {
let native = get_native_backend();
let cuda = get_cuda_backend();
Expand Down
6 changes: 3 additions & 3 deletions rcublas/cublas/src/api/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ mod test {
use super::super::Context;

#[test]
#[serial]
#[serial_test::serial]
fn manual_context_creation() {
unsafe {
let handle = API::ffi_create().unwrap();
Expand All @@ -115,7 +115,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn default_pointer_mode_is_host() {
unsafe {
let context = Context::new().unwrap();
Expand All @@ -125,7 +125,7 @@ mod test {
}

#[test]
#[serial]
#[serial_test::serial]
fn can_set_pointer_mode() {
unsafe {
let context = Context::new().unwrap();
Expand Down
4 changes: 2 additions & 2 deletions rcudnn/cudnn/benches/cudnn_overhead.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ mod cudnn_spec {
use rcudnn::Cudnn;

#[test]
#[serial]
#[serial_test::serial]
fn it_initializes_correctly() {
/*
match Cudnn::new() {
Expand All @@ -29,7 +29,7 @@ mod cudnn_spec {
}

#[test]
#[serial]
#[serial_test::serial]
fn it_returns_version() {
println!("cuDNN Version: {:?}", Cudnn::version());
}
Expand Down
14 changes: 7 additions & 7 deletions rcudnn/cudnn/tests/cudnn_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ mod cudnn_spec {
};

#[test]
#[serial]
#[serial_test::serial]
fn it_initializes_correctly() {
let cuda = Cuda::new();
println!("{:?}", cuda.hardwares());
Expand All @@ -36,7 +36,7 @@ mod cudnn_spec {
}

#[test]
#[serial]
#[serial_test::serial]
fn it_returns_version() {
println!("cuDNN Version: {:?}", Cudnn::version());
}
Expand All @@ -49,7 +49,7 @@ mod cudnn_spec {
* Since then this has been rewritten to not use transmute but a sequence of unsafe optimizations.
*/
#[test]
#[serial]
#[serial_test::serial]
fn it_computes_sigmoid() {
let cudnn = Cudnn::new().unwrap();
let desc = TensorDescriptor::new(&[2, 2, 2], &[4, 2, 1], DataType::Float).unwrap();
Expand Down Expand Up @@ -84,7 +84,7 @@ mod cudnn_spec {
}

#[test]
#[serial]
#[serial_test::serial]
fn it_finds_correct_convolution_algorithm_forward() {
let cudnn = Cudnn::new().unwrap();
let src = TensorDescriptor::new(&[2, 2, 2], &[4, 2, 1], DataType::Float).unwrap();
Expand All @@ -107,7 +107,7 @@ mod cudnn_spec {
}

#[test]
#[serial]
#[serial_test::serial]
fn it_finds_correct_convolution_algorithm_backward() {
let cudnn = Cudnn::new().unwrap();
let src = TensorDescriptor::new(&[2, 2, 2], &[4, 2, 1], DataType::Float).unwrap();
Expand All @@ -130,14 +130,14 @@ mod cudnn_spec {
}

#[test]
#[serial]
#[serial_test::serial]
fn it_allocates_cuda_device_memory() {
let _ = Cudnn::new().unwrap();
let _ = CudaDeviceMemory::new(1024).unwrap();
}

#[test]
#[serial]
#[serial_test::serial]
fn it_computes_dropout_forward() {
let cudnn = Cudnn::new().unwrap();
let src = TensorDescriptor::new(&[2, 2, 2], &[4, 2, 1], DataType::Float).unwrap();
Expand Down
2 changes: 1 addition & 1 deletion rcudnn/cudnn/tests/tensor_descriptor_specs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ mod tensor_descriptor_spec {
use crate::cudnn::TensorDescriptor;

#[test]
#[serial]
#[serial_test::serial]
fn it_initializes_a_tensor_descriptor() {
match TensorDescriptor::new(&[2, 2, 2], &[4, 2, 1], DataType::Float) {
Ok(_) => assert!(true),
Expand Down

0 comments on commit 7f3a5a2

Please sign in to comment.