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

omp.h missing #939

Closed
adrianlut opened this issue Mar 24, 2023 · 5 comments
Closed

omp.h missing #939

adrianlut opened this issue Mar 24, 2023 · 5 comments

Comments

@adrianlut
Copy link

Hi,

I want to use some of the supported runtime routines of OpenMP inside the enclave, for example omp_set_num_threads. However, I noticed that although pthread.h is included in the SDK (under include/tlibc), omp.h is not, causing compilation to fail with

Enclave.cpp:35:10: fatal error: omp.h: No such file or directory
   35 | #include <omp.h>
      |          ^~~~~~~

Why is omp.h not included? Is there some easy workaround I am missing? Thanks!

@llly
Copy link
Contributor

llly commented Mar 27, 2023

OpenMP is not exposed in SGXSDK. You can follow the steps to use it in SGX enclave.

  1. Build SGXSDK.
  2. Copy header file. cp external/openmp/openmp_code/final/build/runtime/src/omp.h $SGX_SDK/include/
  3. Update Makefile. Add -fopenmp at the end of SGX_COMMON_FLAGS, and Add -lsgx_pthread -lsgx_omp between -Wl,--start-group and -Wl,--end-group of Enclave_Link_Flags
  4. Update EDL file. Add from "sgx_pthread.edl" import *;

@ChampionNan
Copy link

#826
Hi, maybe you can follow this.

@adrianlut
Copy link
Author

Hi @llly,

thank you very much for the guide. Building the SDK and copying the header file solved my problem. I already had the flags and EDL import setup.

However, I still want to ask if there is a special reason for not including this header file in the installer. Since a lot of functions from OpenMP are described as supported in the documentation, I would expect that it is possible to use them out of the box.

Maybe omp.h could be added to the default installer in one of the next SDK versions.

@andyzyb
Copy link
Contributor

andyzyb commented Mar 28, 2023

We don't plan to support/release OpenMP as part of the SDK. It is more a side effect of enabling DNNL.

Any issues or new feature requests of using OpenMP probably won't be fixed/supported. That's why omp.h is not included.

@adrianlut
Copy link
Author

Ok, thank you for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants