Repository: pytorch
Issue: PyTorch can not be compiled with MKLDNN if system compiler is clang
Labels: module: build,triaged,module: mkldnn

### 🐛 Describe the bug

I'm trying to move clang configs to use clang for all building and linking, but it breaks `MKLDNNs` ability to detect presence of OpenMP on the system, see https://github.com/pytorch/pytorch/actions/runs/5194566413/jobs/9366365622 as an example:
```2023-06-07T00:46:50.4545541Z -- DNNL_LIBRARY_NAME: dnnl
2023-06-07T00:46:52.0985234Z [33mCMake Warning (dev) at /opt/conda/envs/py_3.9/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
2023-06-07T00:46:52.0985917Z   The package name passed to `find_package_handle_standard_args` (OpenMP_C)
2023-06-07T00:46:52.0986252Z   does not match the name of the calling package (OpenMP).  This can lead to
2023-06-07T00:46:52.0986685Z   problems in calling code that expects `find_package` result variables
2023-06-07T00:46:52.0987045Z   (e.g., `_FOUND`) to follow a certain pattern.
2023-06-07T00:46:52.0987305Z Call Stack (most recent call first):
2023-06-07T00:46:52.0987709Z   cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
2023-06-07T00:46:52.0988470Z   third_party/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:69 (find_package)
2023-06-07T00:46:52.0989047Z   third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
2023-06-07T00:46:52.0989682Z This warning is for project developers.  Use -Wno-dev to suppress it.
2023-06-07T00:46:52.0990173Z [0m
2023-06-07T00:46:52.0990533Z -- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES) 
2023-06-07T00:46:52.0991065Z [33mCMake Warning (dev) at /opt/conda/envs/py_3.9/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
2023-06-07T00:46:52.0991481Z   The package name passed to `find_package_handle_standard_args` (OpenMP_CXX)
2023-06-07T00:46:52.0991815Z   does not match the name of the calling package (OpenMP).  This can lead to
2023-06-07T00:46:52.0992122Z   problems in calling code that expects `find_package` result variables
2023-06-07T00:46:52.0992446Z   (e.g., `_FOUND`) to follow a certain pattern.
2023-06-07T00:46:52.0992811Z Call Stack (most recent call first):
2023-06-07T00:46:52.0993327Z   cmake/Modules/FindOpenMP.cmake:584 (find_package_handle_standard_args)
2023-06-07T00:46:52.0993838Z   third_party/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:69 (find_package)
2023-06-07T00:46:52.0994243Z   third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
2023-06-07T00:46:52.0994658Z This warning is for project developers.  Use -Wno-dev to suppress it.
2023-06-07T00:46:52.0995043Z [0m
2023-06-07T00:46:52.0995632Z -- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES) 
2023-06-07T00:46:52.0996131Z -- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND) 
2023-06-07T00:46:52.0996569Z [31mCMake Error at third_party/ideep/mkl-dnn/third_party/oneDNN/cmake/OpenMP.cmake:118 (message):
2023-06-07T00:46:52.0996907Z   OpenMP library could not be found.  Proceeding might lead to highly
2023-06-07T00:46:52.0997198Z   sub-optimal performance.
2023-06-07T00:46:52.0997419Z Call Stack (most recent call first):
2023-06-07T00:46:52.0997751Z   third_party/ideep/mkl-dnn/third_party/oneDNN/CMakeLists.txt:117 (include)
2023-06-07T00:46:52.0997941Z 
2023-06-07T00:46:52.0998025Z [0m
```

`oneDNN` should either gracefully handle the failure or , better, use the same methods for locating OpenMP runtime as PyTorch.

### Versions

CI

cc @seemethere @gujinghui @PenghuiCheng @XiaobingSuper @jianyuh @jgong5 @mingfeima @sanchitintel @ashokei @jingxu10 @min-jean-cho @yanbing-j @Guobing-Chen @Xia-Weiwen