@@ -474,6 +474,9 @@ TEST_F(AutogradCudaTest, LinearForwardCUDA) {
474474
475475#ifdef USE_NCCL
476476TEST_F (AutogradDistributedTest, AllReduceDistributed) {
477+ REQUIRE_CUDA ();
478+ REQUIRE_DISTRIBUTED ();
479+ REQUIRE_NCCL ();
477480 auto a = std::make_shared<Tensor>(std::vector<int64_t >{2 , 3 }, DataType::kFLOAT32 ,
478481 Device (Device::DeviceType::kCUDA , 0 ));
479482 a->set_requires_grad (true );
@@ -485,6 +488,9 @@ TEST_F(AutogradDistributedTest, AllReduceDistributed) {
485488}
486489
487490TEST_F (AutogradDistributedTest, AllGatherDistributed) {
491+ REQUIRE_CUDA ();
492+ REQUIRE_DISTRIBUTED ();
493+ REQUIRE_NCCL ();
488494 auto a = std::make_shared<Tensor>(std::vector<int64_t >{4 , 4 }, DataType::kFLOAT32 ,
489495 Device (Device::DeviceType::kCUDA , 0 ));
490496 a->set_requires_grad (true );
@@ -496,6 +502,9 @@ TEST_F(AutogradDistributedTest, AllGatherDistributed) {
496502}
497503
498504TEST_F (AutogradDistributedTest, ReduceScatterDistributed) {
505+ REQUIRE_CUDA ();
506+ REQUIRE_DISTRIBUTED ();
507+ REQUIRE_NCCL ();
499508 auto a = std::make_shared<Tensor>(std::vector<int64_t >{2 , 8 }, DataType::kFLOAT32 ,
500509 Device (Device::DeviceType::kCUDA , 0 ));
501510 a->set_requires_grad (true );
@@ -507,6 +516,9 @@ TEST_F(AutogradDistributedTest, ReduceScatterDistributed) {
507516}
508517
509518TEST_F (AutogradDistributedTest, DistributedMatmul) {
519+ REQUIRE_CUDA ();
520+ REQUIRE_DISTRIBUTED ();
521+ REQUIRE_NCCL ();
510522 auto a = std::make_shared<Tensor>(std::vector<int64_t >{2 , 4 }, DataType::kFLOAT32 ,
511523 Device (Device::DeviceType::kCUDA , 0 ));
512524 a->set_requires_grad (true );
@@ -522,6 +534,9 @@ TEST_F(AutogradDistributedTest, DistributedMatmul) {
522534}
523535
524536TEST_F (AutogradDistributedTest, DistributedLinear) {
537+ REQUIRE_CUDA ();
538+ REQUIRE_DISTRIBUTED ();
539+ REQUIRE_NCCL ();
525540 auto input = std::make_shared<Tensor>(std::vector<int64_t >{2 , 3 }, DataType::kFLOAT32 ,
526541 Device (Device::DeviceType::kCUDA , 0 ));
527542 input->set_requires_grad (true );
0 commit comments