simpleomp.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. // Tencent is pleased to support the open source community by making ncnn available.
  2. //
  3. // Copyright (C) 2020 THL A29 Limited, a Tencent company. All rights reserved.
  4. //
  5. // Licensed under the BSD 3-Clause License (the "License"); you may not use this file except
  6. // in compliance with the License. You may obtain a copy of the License at
  7. //
  8. // https://opensource.org/licenses/BSD-3-Clause
  9. //
  10. // Unless required by applicable law or agreed to in writing, software distributed
  11. // under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
  12. // CONDITIONS OF ANY KIND, either express or implied. See the License for the
  13. // specific language governing permissions and limitations under the License.
  14. #ifndef NCNN_SIMPLEOMP_H
  15. #define NCNN_SIMPLEOMP_H
  16. #include "platform.h"
  17. #if NCNN_SIMPLEOMP
  18. #include <stdint.h>
  19. // This minimal openmp runtime implementation only supports the llvm openmp abi
  20. // and only supports #pragma omp parallel for num_threads(X)
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. NCNN_EXPORT int omp_get_max_threads();
  25. NCNN_EXPORT void omp_set_num_threads(int num_threads);
  26. NCNN_EXPORT int omp_get_dynamic();
  27. NCNN_EXPORT void omp_set_dynamic(int dynamic);
  28. NCNN_EXPORT int omp_get_num_threads();
  29. NCNN_EXPORT int omp_get_thread_num();
  30. NCNN_EXPORT int kmp_get_blocktime();
  31. NCNN_EXPORT void kmp_set_blocktime(int blocktime);
  32. #ifdef __cplusplus
  33. }
  34. #endif
  35. #endif // NCNN_SIMPLEOMP
  36. #endif // NCNN_SIMPLEOMP_H