Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 9, 2024. It is now read-only.

Commit 5054769

Browse files
lindong28tfboyd
authored andcommitted
Create drive in setup.py for PerfZero (#321)
1 parent 6231a10 commit 5054769

File tree

3 files changed

+19
-13
lines changed

3 files changed

+19
-13
lines changed

perfzero/lib/benchmark.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import time
2727
import traceback
2828

29-
import perfzero.device_utils as device_utils
3029
import perfzero.perfzero_config as perfzero_config
3130
import perfzero.report_utils as report_utils
3231
import perfzero.utils as utils
@@ -45,11 +44,6 @@ def __init__(self, config):
4544

4645
def _setup(self):
4746
"""Download data and checkout git repository."""
48-
# Set up the raid array.
49-
start_time = time.time()
50-
device_utils.create_drive_from_devices(self.config.root_data_dir,
51-
self.config.gce_nvme_raid)
52-
self.benchmark_execution_time['create_drive'] = time.time() - start_time
5347

5448
# Acticate gcloud service
5549
start_time = time.time()

perfzero/lib/perfzero/perfzero_config.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,18 @@ def add_setup_parser_arguments(parser):
3939
type=str,
4040
help='''The gcloud key file url. When specified, it will be downloaded to the directory specified by the flag --workspace.
4141
''')
42+
parser.add_argument(
43+
'--root_data_dir',
44+
default='/data',
45+
type=str,
46+
help='The directory which should contain the dataset required by the becnhmark method.'
47+
)
48+
parser.add_argument(
49+
'--gce_nvme_raid',
50+
default=None,
51+
type=str,
52+
help='If set to non-empty string, create raid 0 array with devices at the directory specified by the flag --root_data_dir'
53+
)
4254

4355

4456
def add_benchmark_parser_arguments(parser):
@@ -48,12 +60,6 @@ def add_benchmark_parser_arguments(parser):
4860
action='store_true',
4961
help='If set, do git pull for dependent git repositories'
5062
)
51-
parser.add_argument(
52-
'--gce_nvme_raid',
53-
default=None,
54-
type=str,
55-
help='If set to non-empty string, create raid 0 array with devices at the directory specified by the flag --root_data_dir'
56-
)
5763
parser.add_argument(
5864
'--gcs_downloads',
5965
default=None,
@@ -185,7 +191,6 @@ def __init__(self, mode, flags=None):
185191
self.mode = mode
186192
self.flags = flags
187193
if mode == 'flags':
188-
self.gce_nvme_raid = flags.gce_nvme_raid
189194
self.gcs_downloads_str = flags.gcs_downloads
190195
self.data_downloads_str = flags.data_downloads
191196
self.git_repos_str = flags.git_repos

perfzero/lib/setup.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import os
2222
import time
2323

24+
import perfzero.device_utils as device_utils
2425
import perfzero.perfzero_config as perfzero_config
2526
import perfzero.utils as utils
2627

@@ -46,6 +47,12 @@
4647
utils.active_gcloud_service(FLAGS.gcloud_key_file_url, workspace_dir, download_only=True) # pylint: disable=line-too-long
4748
setup_execution_time['download_token'] = time.time() - start_time
4849

50+
# Set up the raid array.
51+
start_time = time.time()
52+
device_utils.create_drive_from_devices(FLAGS.root_data_dir, FLAGS.gce_nvme_raid) # pylint: disable=line-too-long
53+
setup_execution_time['create_drive'] = time.time() - start_time
54+
55+
# Create docker image
4956
start_time = time.time()
5057
dockerfile_path = os.path.join(project_dir, FLAGS.dockerfile_path)
5158
docker_tag = 'temp/tf-gpu'

0 commit comments

Comments
 (0)