Set default compiler differently according to platform (#43890)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/43890

1. auto-detect `CXX` default compiler type in oss, and `clang` as default compiler type in fbcode (because auto-detecting will say `gcc` is the default compiler on devserver).

2. change `compiler type` from str `"CLANG" "GCC"` to enum type
3. rename function `get_cov_type` to `detect_compiler_type`
4. auto-set the default pytorch folder for users in oss

Test Plan:
on devserver:
```
buck run :coverage //caffe2/c10:
```

on oss:
```
python oss_coverage.py --run-only=atest
```

Reviewed By: malfet

Differential Revision: D23420034

fbshipit-source-id: c0ea88188578bb1343a286f2090eb8a74cdf3982
This commit is contained in:
Yujun Zhao
2020-09-08 14:55:40 -07:00
committed by Facebook GitHub Bot
parent 1fcccd6a18
commit 49e979bfde
7 changed files with 93 additions and 36 deletions

View File

@ -5,14 +5,13 @@ from typing import Dict, List, Set
# <project folder>
HOME_DIR = os.environ["HOME"]
setting_file_path = os.path.realpath(__file__)
SCRIPT_FOLDER = os.path.join(
os.path.dirname(setting_file_path), os.path.pardir, os.path.pardir
TOOLS_FOLDER = os.path.join(
os.path.dirname(os.path.realpath(__file__)), os.path.pardir, os.path.pardir
)
# <profile folder>
PROFILE_DIR = os.path.join(SCRIPT_FOLDER, "profile")
PROFILE_DIR = os.path.join(TOOLS_FOLDER, "profile")
JSON_FOLDER_BASE_DIR = os.path.join(PROFILE_DIR, "json")
MERGED_FOLDER_BASE_DIR = os.path.join(PROFILE_DIR, "merged")
SUMMARY_FOLDER_DIR = os.path.join(PROFILE_DIR, "summary")
@ -60,3 +59,9 @@ class Option:
class TestPlatform(Enum):
FBCODE: str = "fbcode"
OSS: str = "oss"
# compiler type
class CompilerType(Enum):
CLANG: str = "clang"
GCC: str = "gcc"