Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Use of CPU and GPU Queues #668

Merged
merged 4 commits into from
Feb 1, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Raster Vision 0.9.0
- Add ability to shift raster images by given numbers of meters. `#573 <https://github.com/azavea/raster-vision/pull/573>`_
- Add ability to generate GeoJSON segmentation predictions. `#575 <https://github.com/azavea/raster-vision/pull/575>`_
- Add ability to run the DeepLab eval script. `#653 <https://github.com/azavea/raster-vision/pull/653>`_
- Submit CPU-only stages to a CPU queue on Aws. `#668 <https://github.com/azavea/raster-vision/pull/668>`_

Raster Vision 0.8
-----------------
Expand Down
30 changes: 28 additions & 2 deletions rastervision/runner/aws_batch_experiment_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@

from rastervision.runner import OutOfProcessExperimentRunner
from rastervision.rv_config import RVConfig
import rastervision as rv

CPU_STAGES = {rv.ANALYZE, rv.CHIP, rv.EVAL, rv.BUNDLE}


class AwsBatchExperimentRunner(OutOfProcessExperimentRunner):
Expand All @@ -24,6 +27,14 @@ def __init__(self):
job_queue = 'raster-vision-cpu'
self.job_queue = job_queue

cpu_job_queue = batch_config('cpu_job_queue', default='')
if not cpu_job_queue:
if self.gpu:
cpu_job_queue = 'raster-vision-cpu'
else:
cpu_job_queue = job_queue
self.cpu_job_queue = cpu_job_queue

job_definition = batch_config('job_definition', default='')
if not job_definition:
if self.gpu:
Expand All @@ -32,6 +43,14 @@ def __init__(self):
job_definition = 'raster-vision-cpu'
self.job_definition = job_definition

cpu_job_definition = batch_config('cpu_job_definition', default='')
if not cpu_job_definition:
if self.gpu:
cpu_job_definition = 'raster-vision-cpu'
else:
cpu_job_definition = job_definition
self.cpu_job_definition = cpu_job_definition

self.submit = self.batch_submit
self.execution_environment = 'Batch'

Expand Down Expand Up @@ -65,10 +84,17 @@ def batch_submit(self,
job_name = '{}_{}_{}'.format(command_type, exp, uuid_part)
depends_on = [{'jobId': job_id} for job_id in parent_job_ids]

if command_type in CPU_STAGES:
job_queue = self.cpu_job_queue
job_definition = self.cpu_job_definition
else:
job_queue = self.job_queue
job_definition = self.job_definition

kwargs = {
'jobName': job_name,
'jobQueue': self.job_queue,
'jobDefinition': self.job_definition,
'jobQueue': job_queue,
'jobDefinition': job_definition,
'containerOverrides': {
'command': full_command
},
Expand Down