Optimize TensorFlow: Difference between revisions

From HPCWIKI
Jump to navigation Jump to search
(Fix: remove --- horizontal lines (7 removed))
({{Status}}/{{TOC}} 템플릿 제거)
 
Line 1: Line 1:
{{Status
|status=Draft
|owner=Knowledge Agent
|last_update=2026-07-16
|review=Pending
}}
{{TOC}}
== Overview ==
== Overview ==


Line 17: Line 8:
* 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
* 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
* 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시
* 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시


== Purpose ==
== Purpose ==
Line 26: Line 16:
* Scope: Optimize TensorFlow의 개념, 사용법, 설정
* Scope: Optimize TensorFlow의 개념, 사용법, 설정
* Non-goals: 다른 주제로의 확장
* Non-goals: 다른 주제로의 확장


== Key Concepts ==
== Key Concepts ==
Line 39: Line 28:
| [[Linux]], [[Server]]
| [[Linux]], [[Server]]
|}
|}


== Detailed Explanation ==
== Detailed Explanation ==
Line 63: Line 51:
  -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw
  -mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw
  -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps
  -mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps


== Best Practices ==
== Best Practices ==
Line 70: Line 57:
* 공식 문서 참고
* 공식 문서 참고
* 테스트 환경에서 먼저 검증
* 테스트 환경에서 먼저 검증


== References ==
== References ==


* [https://wiki.hpcmate.com Optimize TensorFlow]
* [https://wiki.hpcmate.com Optimize TensorFlow]


== Related Pages ==
== Related Pages ==
Line 83: Line 68:
* [[Hardware]]
* [[Hardware]]
* [[Network]]
* [[Network]]


[[Category:Server]]
[[Category:Server]]

Latest revision as of 13:25, 2 October 2026

Overview

Optimize TensorFlow에 대한 기술 문서입니다.

Summary

  • 무엇인가? - Optimize TensorFlow
  • 왜 필요한가? - HPC 및 서버 환경에서 필수 개념
  • 언제 사용하는가? - 서버 구성, 성능 튜닝, 문제 해결 시

Purpose

이 문서가 존재하는 이유

  • Goal: Optimize TensorFlow에 대한 기술 정보 제공
  • Scope: Optimize TensorFlow의 개념, 사용법, 설정
  • Non-goals: 다른 주제로의 확장

Key Concepts

Concept Description Related
Optimize TensorFlow HPC/서버 환경에서 중요한 기술 개념 Linux, Server

Detailed Explanation

Optimize TensorFlow to CPU features by turning on all the computation optimization opportunities provided by the CPU. Do you wondering how much of a difference those instructions end up making on your machine between genera pip packages and custom optimization on the system? Because pre-built pip packages do not enable all machine capable optimization flags in it or may not perfectly set for your machine, for example, GCC compiler optimization flgags like gcc -O<number> (O the letter, not the number).

  • -O0: Turns off optimization entirely. Fast compile times, good for debugging. This is the default if you don't specify any which you probably don't want.
  • -O1: Basic optimization level.
  • -O2: Recommended for most things. SSE / AVX may be used, but not fully.
  • -O3: Highest optimization possible. Also vectorizes loops, can use all AVX registers.
  • -Os: Small size. Basically enables -O2 options which do not increase size. Can be useful for machines that have limited storage and/or CPUs with small cache sizes.

If you are building TensorFlow on the same machine that will be running it you can just use -O3 -march=native. If you are building on a different machine, you can use the command below to see which flags GCC would set and then pass them when configuring TF.

# This is the output on my machine:
$ gcc -march=native -E -v - </dev/null 2>&1 | grep cc1
/usr/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/cc1 -E -quiet -v - -march=znver1
-mmmx -mno-3dnow -msse -msse2 -msse3 -mssse3 -msse4a -mcx16 -msahf -mmovbe
-maes -msha -mpclmul -mpopcnt -mabm -mno-lwp -mfma -mno-fma4 -mno-xop -mbmi
-mno-sgx -mbmi2 -mno-tbm -mavx -mavx2 -msse4.2 -msse4.1 -mlzcnt -mno-rtm
-mno-hle -mrdrnd -mf16c -mfsgsbase -mrdseed -mprfchw -madx -mfxsr -mxsave
-mxsaveopt -mno-avx512f -mno-avx512er -mno-avx512cd -mno-avx512pf
-mno-prefetchwt1 -mclflushopt -mxsavec -mxsaves -mno-avx512dq -mno-avx512bw
-mno-avx512vl -mno-avx512ifma -mno-avx512vbmi -mno-avx5124fmaps

Best Practices

  • 최신 버전 사용 권장
  • 공식 문서 참고
  • 테스트 환경에서 먼저 검증

References

Related Pages

Knowledge Graph

Related

→ Linux → Server → Hardware → Network