Register flags for specifying performance tuning arguments. Args: num_parallel_calls: Create a flag to specify parallelism of data loading. inter_op: Create a flag to allow specification of inter op threads. intra_op: Create a flag to allow specification of intra op threads. synth
(num_parallel_calls=False,
inter_op=False,
intra_op=False,
synthetic_data=False,
max_train_steps=False,
dtype=False,
all_reduce_alg=False,
num_packs=False,
tf_gpu_thread_mode=False,
datasets_num_private_threads=False,
datasets_num_parallel_batches=False,
fp16_implementation=False,
loss_scale=False,
tf_data_experimental_slack=False,
enable_xla=False,
training_dataset_cache=False)
| 51 | |
| 52 | |
| 53 | def define_performance(num_parallel_calls=False, |
| 54 | inter_op=False, |
| 55 | intra_op=False, |
| 56 | synthetic_data=False, |
| 57 | max_train_steps=False, |
| 58 | dtype=False, |
| 59 | all_reduce_alg=False, |
| 60 | num_packs=False, |
| 61 | tf_gpu_thread_mode=False, |
| 62 | datasets_num_private_threads=False, |
| 63 | datasets_num_parallel_batches=False, |
| 64 | fp16_implementation=False, |
| 65 | loss_scale=False, |
| 66 | tf_data_experimental_slack=False, |
| 67 | enable_xla=False, |
| 68 | training_dataset_cache=False): |
| 69 | """Register flags for specifying performance tuning arguments. |
| 70 | |
| 71 | Args: |
| 72 | num_parallel_calls: Create a flag to specify parallelism of data loading. |
| 73 | inter_op: Create a flag to allow specification of inter op threads. |
| 74 | intra_op: Create a flag to allow specification of intra op threads. |
| 75 | synthetic_data: Create a flag to allow the use of synthetic data. |
| 76 | max_train_steps: Create a flags to allow specification of maximum number of |
| 77 | training steps |
| 78 | dtype: Create flags for specifying dtype. |
| 79 | all_reduce_alg: If set forces a specific algorithm for multi-gpu. |
| 80 | num_packs: If set provides number of packs for MirroredStrategy's cross |
| 81 | device ops. |
| 82 | tf_gpu_thread_mode: gpu_private triggers us of private thread pool. |
| 83 | datasets_num_private_threads: Number of private threads for datasets. |
| 84 | datasets_num_parallel_batches: Determines how many batches to process in |
| 85 | parallel when using map and batch from tf.data. |
| 86 | fp16_implementation: Create fp16_implementation flag. |
| 87 | loss_scale: Controls the loss scaling, normally for mixed-precision |
| 88 | training. Can only be turned on if dtype is also True. |
| 89 | tf_data_experimental_slack: Determines whether to enable tf.data's |
| 90 | `experimental_slack` option. |
| 91 | enable_xla: Determines if XLA (auto clustering) is turned on. |
| 92 | training_dataset_cache: Whether to cache the training dataset on workers. |
| 93 | Typically used to improve training performance when training data is in |
| 94 | remote storage and can fit into worker memory. |
| 95 | |
| 96 | Returns: |
| 97 | A list of flags for core.py to marks as key flags. |
| 98 | """ |
| 99 | |
| 100 | key_flags = [] |
| 101 | if num_parallel_calls: |
| 102 | flags.DEFINE_integer( |
| 103 | name="num_parallel_calls", |
| 104 | short_name="npc", |
| 105 | default=multiprocessing.cpu_count(), |
| 106 | help=help_wrap("The number of records that are processed in parallel " |
| 107 | "during input processing. This can be optimized per " |
| 108 | "data set but for generally homogeneous data sets, " |
| 109 | "should be approximately the number of available CPU " |
| 110 | "cores. (default behavior)")) |
nothing calls this directly
no test coverage detected