[tune] Add Fractional GPU example/docs (#3169)

* Add example for fractional GPU support

* Update tune_mnist_keras.py

* Update doc/source/tune-usage.rst
This commit is contained in:
Richard Liaw
2018-10-31 18:53:16 -07:00
committed by GitHub
parent 1f29a960f4
commit 2086a57e61
2 changed files with 11 additions and 2 deletions
+8 -2
View File
@@ -105,6 +105,8 @@ def create_parser():
parser = argparse.ArgumentParser(description='Keras MNIST Example')
parser.add_argument(
"--smoke-test", action="store_true", help="Finish quickly for testing")
parser.add_argument(
"--use-gpu", action="store_true", help="Use GPU in training.")
parser.add_argument(
'--jobs',
type=int,
@@ -113,8 +115,8 @@ def create_parser():
parser.add_argument(
'--threads',
type=int,
default=None,
help='threads used in operations (default: all)')
default=2,
help='threads used in operations (default: 2)')
parser.add_argument(
'--steps',
type=float,
@@ -185,6 +187,10 @@ if __name__ == '__main__':
},
"run": "train_mnist",
"num_samples": 1 if args.smoke_test else 10,
"trial_resources": {
"cpu": args.threads,
"gpu": 0.5 if args.use_gpu else 0
},
"config": {
"lr": lambda spec: np.random.uniform(0.001, 0.1),
"momentum": lambda spec: np.random.uniform(0.1, 0.9),