Esempio n. 1
0
 def test_nprocs_not_equal_to_selected_devices(self):
     with self.assertRaises(ValueError):
         options = dict()
         options['selected_devices'] = "100,101,102"
         _get_subprocess_env_list(nprocs=2, options=options)
Esempio n. 2
0
 def test_get_correct_env(self):
     options = dict()
     options['print_config'] = True
     env_dict = _get_subprocess_env_list(nprocs=1, options=options)[0]
     self.assertEqual(env_dict['PADDLE_TRAINER_ID'], '0')
     self.assertEqual(env_dict['PADDLE_TRAINERS_NUM'], '1')
Esempio n. 3
0
 def test_nprocs_greater_than_device_num_error(self):
     with self.assertRaises(RuntimeError):
         _get_subprocess_env_list(nprocs=100, options=dict())
Esempio n. 4
0
 def test_get_correct_env(self):
     env_dict = _get_subprocess_env_list(nprocs=1, options=dict())[0]
     self.assertEqual(env_dict['PADDLE_TRAINER_ID'], '0')
     self.assertEqual(env_dict['PADDLE_TRAINERS_NUM'], '1')
Esempio n. 5
0
 def test_selected_gpus_error(self):
     with self.assertRaises(ValueError):
         options = dict()
         options['selected_gpus'] = "100,101"
         _get_subprocess_env_list(nprocs=2, options=options)
Esempio n. 6
0
 def test_only_cluster_node_ips_error(self):
     with self.assertRaises(ValueError):
         options = dict()
         options['cluster_node_ips'] = "127.0.0.1,127.0.0.2"
         _get_subprocess_env_list(nprocs=1, options=options)