Set some ENV for these DeepRec's features enabled by ENV. More Detail information is shown in https://deeprec.readthedocs.io/zh/latest/index.html. START_STATISTIC_STEP & STOP_STATISTIC_STEP: On CPU platform, DeepRec supports memory optimization in both stand-alone and distri
()
| 1014 | # This func is used to set ENV and enable these features. |
| 1015 | # A triple quotes comment is used to introduce these features and play an emphasizing role. |
| 1016 | def set_env_for_DeepRec(): |
| 1017 | ''' |
| 1018 | Set some ENV for these DeepRec's features enabled by ENV. |
| 1019 | More Detail information is shown in https://deeprec.readthedocs.io/zh/latest/index.html. |
| 1020 | START_STATISTIC_STEP & STOP_STATISTIC_STEP: On CPU platform, DeepRec supports memory optimization |
| 1021 | in both stand-alone and distributed trainging. It's default to open, and the |
| 1022 | default start and stop steps of collection is 1000 and 1100. Reduce the initial |
| 1023 | cold start time by the following settings. |
| 1024 | MALLOC_CONF: On CPU platform, DeepRec can use memory optimization with the jemalloc library. |
| 1025 | Please preload libjemalloc.so by `LD_PRELOAD=./libjemalloc.so.2 python ...` |
| 1026 | ''' |
| 1027 | os.environ['START_STATISTIC_STEP'] = '100' |
| 1028 | os.environ['STOP_STATISTIC_STEP'] = '110' |
| 1029 | os.environ['MALLOC_CONF']= \ |
| 1030 | 'background_thread:true,metadata_thp:auto,dirty_decay_ms:20000,muzzy_decay_ms:20000' |
| 1031 | if args.group_embedding == "collective": |
| 1032 | tf.config.experimental.enable_distributed_strategy(strategy="collective") |
| 1033 | if args.smartstaged and not args.tf: |
| 1034 | os.environ["TF_GPU_THREAD_COUNT"] = "16" |
| 1035 | |
| 1036 | if __name__ == '__main__': |
| 1037 | parser = get_arg_parser() |