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

Enter training time for BF16 using AVX512 #2620

Open
wants to merge 5 commits into
base: development
Choose a base branch
from

Conversation

jafraustro
Copy link

Update IntelPyTorch training notebook to include environment variable settings for AVX512 and BF16 optimizations

Existing Sample Changes

Description

Update IntelPyTorch training notebook to include environment variable settings for AVX512 and BF16 optimizations

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Command Line
  • oneapi-cli
  • Visual Studio
  • Eclipse IDE
  • VSCode
  • When compiling the compliler flag "-Wall -Wformat-security -Werror=format-security" was used

Verified

This commit was signed with the committer’s verified signature.
jafraustro Jaime Fraustro
Update IntelPyTorch training notebook to include environment variable settings for AVX512 and BF16 optimizations

Signed-off-by: Francisco R Castro G <francisco.castro.garcia@intel.com>
Signed-off-by: jafraustro <jaime.fraustro.valdez@intel.com>
@Ankur-singh
Copy link
Contributor

@jafraustro can you please verify if the environment variable is actually affecting the trainModel function?

image

It would to ideal to have the trainModel function in a separate script. This would allow use to do the following, making sure that the env variable is initialized properly:

# In jupyter notebook cell
os.environ["ONEDNN_MAX_CPU_ISA"] = "AVX512_CORE_BF16"
!python pytorch_training_avx512_bf16.py

I also see pytorch_training_amx_bf16.py and pytorch_training_avx512_bf16.py scripts with mostly the same code. Even these scripts can be cleaned. Let me know what you think?

Verified

This commit was signed with the committer’s verified signature.
jafraustro Jaime Fraustro
- BF16 without Intel® AMX example is executed from a python script. The bf16_noAmx_training_time variables is saved in a txt file.

- Use torch.amp.autocast('cpu') instead of torch.cpu.amp.autocast()

Signed-off-by: jafraustro <jaime.fraustro.valdez@intel.com>
fix typo

Verified

This commit was signed with the committer’s verified signature.
jafraustro Jaime Fraustro
Signed-off-by: jafraustro <jaime.fraustro.valdez@intel.com>
@jafraustro
Copy link
Author

Hi @Ankur-singh,

You are right about the ONEDNN_MAX_CPU_ISA variable.

I made the following changes:

  • The file pytorch_training_amx_bf16.py has been removed since the code is in the notebook.
  • The file pytorch_training_avx512_bf16.py is used to run the same code, but it sets the environment variable os.environ["ONEDNN_MAX_CPU_ISA"] = "AVX512_CORE_BF16".
  • The variable bf16_avx512_training_time is now saved in a file for use in the notebook.

Verified

This commit was signed with the committer’s verified signature.
jafraustro Jaime Fraustro
Signed-off-by: jafraustro <jaime.fraustro.valdez@intel.com>

Verified

This commit was signed with the committer’s verified signature.
jafraustro Jaime Fraustro
Signed-off-by: jafraustro <jaime.fraustro.valdez@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants