Skip to content

add an option to enable native compilation optimization#2151

Merged
wanghan-iapcm merged 1 commit into
deepmodeling:develfrom
njzjz:native_optimization
Dec 4, 2022
Merged

add an option to enable native compilation optimization#2151
wanghan-iapcm merged 1 commit into
deepmodeling:develfrom
njzjz:native_optimization

Conversation

@njzjz

@njzjz njzjz commented Dec 3, 2022

Copy link
Copy Markdown
Member

After I enable it, I can observe speedup in some cases. For examples/water/se_e2_a, compress training FP32 networks:

CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=8 TF_INTRA_OP_PARALLELISM_THREADS=8 TF_INTER_OP_PARALLELISM_THREADS=2 dp train input.json -f frozen_model_compressed.pb

Before enabling it,

DEEPMD INFO    batch     100 training time 1.67 s, testing time 0.03 s
DEEPMD INFO    batch     200 training time 1.25 s, testing time 0.03 s
DEEPMD INFO    batch     300 training time 1.23 s, testing time 0.03 s
DEEPMD INFO    batch     400 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     500 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     600 training time 1.23 s, testing time 0.03 s
DEEPMD INFO    batch     700 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     800 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     900 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch    1000 training time 1.24 s, testing time 0.03 s

After enabling it,

DEEPMD INFO    batch     100 training time 1.60 s, testing time 0.03 s
DEEPMD INFO    batch     200 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     300 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     400 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     500 training time 1.11 s, testing time 0.03 s
DEEPMD INFO    batch     600 training time 1.11 s, testing time 0.03 s
DEEPMD INFO    batch     700 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     800 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     900 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch    1000 training time 1.13 s, testing time 0.03 s

About 10% improvement.

After I enable it, I can obseve speedup in some cases.
For `examples/water/se_e2_a`, compress training with FP32 networks:
```
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=8 TF_INTRA_OP_PARALLELISM_THREADS=8 TF_INTER_OP_PARALLELISM_THREADS=2 dp train input.json -f frozen_model_compressed.pb
```

Before enable it,
```
DEEPMD INFO    batch     100 training time 1.67 s, testing time 0.03 s
DEEPMD INFO    batch     200 training time 1.25 s, testing time 0.03 s
DEEPMD INFO    batch     300 training time 1.23 s, testing time 0.03 s
DEEPMD INFO    batch     400 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     500 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     600 training time 1.23 s, testing time 0.03 s
DEEPMD INFO    batch     700 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     800 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     900 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch    1000 training time 1.24 s, testing time 0.03 s
```
After enabling it,
```
DEEPMD INFO    batch     100 training time 1.60 s, testing time 0.03 s
DEEPMD INFO    batch     200 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     300 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     400 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     500 training time 1.11 s, testing time 0.03 s
DEEPMD INFO    batch     600 training time 1.11 s, testing time 0.03 s
DEEPMD INFO    batch     700 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     800 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     900 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch    1000 training time 1.13 s, testing time 0.03 s
```
About 10% improvement.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
@github-actions github-actions Bot added the Docs label Dec 3, 2022
@codecov-commenter

codecov-commenter commented Dec 3, 2022

Copy link
Copy Markdown

Codecov Report

Base: 75.89% // Head: 74.13% // Decreases project coverage by -1.76% ⚠️

Coverage data is based on head (c3a132e) compared to base (bec0174).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##            devel    #2151      +/-   ##
==========================================
- Coverage   75.89%   74.13%   -1.77%     
==========================================
  Files         182      201      +19     
  Lines       16974    19758    +2784     
  Branches      950     1414     +464     
==========================================
+ Hits        12883    14648    +1765     
- Misses       3406     4170     +764     
- Partials      685      940     +255     
Impacted Files Coverage Δ
source/op/gelu_multi_device.cc 51.08% <0.00%> (-3.57%) ⬇️
source/op/tabulate_multi_device.cc 70.54% <0.00%> (-3.29%) ⬇️
source/op/prod_force_grad_multi_device.cc 93.84% <0.00%> (-2.98%) ⬇️
source/op/prod_virial_grad_multi_device.cc 94.52% <0.00%> (-2.67%) ⬇️
source/op/prod_env_mat_multi_device_nvnmd.cc 88.11% <0.00%> (-1.79%) ⬇️
source/op/unaggregated_grad.cc 80.71% <0.00%> (-1.48%) ⬇️
source/lib/include/ComputeDescriptor.h 76.65% <0.00%> (-0.45%) ⬇️
deepmd/train/trainer.py 70.35% <0.00%> (-0.10%) ⬇️
deepmd/descriptor/se_r.py 93.50% <0.00%> (-0.03%) ⬇️
deepmd/descriptor/se_t.py 94.93% <0.00%> (-0.03%) ⬇️
... and 41 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@wanghan-iapcm wanghan-iapcm merged commit 1156c54 into deepmodeling:devel Dec 4, 2022
@njzjz njzjz deleted the native_optimization branch December 4, 2022 02:25
mingzhong15 pushed a commit to mingzhong15/deepmd-kit that referenced this pull request Jan 15, 2023
…#2151)

After I enable it, I can observe speedup in some cases. For
`examples/water/se_e2_a`, compress training FP32 networks:
```sh
CUDA_VISIBLE_DEVICES= OMP_NUM_THREADS=8 TF_INTRA_OP_PARALLELISM_THREADS=8 TF_INTER_OP_PARALLELISM_THREADS=2 dp train input.json -f frozen_model_compressed.pb
```

Before enabling it,
```
DEEPMD INFO    batch     100 training time 1.67 s, testing time 0.03 s
DEEPMD INFO    batch     200 training time 1.25 s, testing time 0.03 s
DEEPMD INFO    batch     300 training time 1.23 s, testing time 0.03 s
DEEPMD INFO    batch     400 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     500 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     600 training time 1.23 s, testing time 0.03 s
DEEPMD INFO    batch     700 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     800 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch     900 training time 1.24 s, testing time 0.03 s
DEEPMD INFO    batch    1000 training time 1.24 s, testing time 0.03 s
```
After enabling it,
```
DEEPMD INFO    batch     100 training time 1.60 s, testing time 0.03 s
DEEPMD INFO    batch     200 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     300 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     400 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     500 training time 1.11 s, testing time 0.03 s
DEEPMD INFO    batch     600 training time 1.11 s, testing time 0.03 s
DEEPMD INFO    batch     700 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     800 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch     900 training time 1.10 s, testing time 0.03 s
DEEPMD INFO    batch    1000 training time 1.13 s, testing time 0.03 s
```
About 10% improvement.

Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants