[Openmp-commits] [PATCH] D74092: Changed omp_get_max_threads() implementation to more closely match spec description.

Ethan Stewart via Phabricator via Openmp-commits openmp-commits at lists.llvm.org
Thu Feb 6 09:44:46 PST 2020


estewart08 updated this revision to Diff 242931.
estewart08 added a comment.

- Update max_threads.c api test to match the change for omp_get_max_threads().


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D74092/new/

https://reviews.llvm.org/D74092

Files:
  openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
  openmp/libomptarget/deviceRTLs/nvptx/test/api/get_max_threads.c
  openmp/libomptarget/deviceRTLs/nvptx/test/api/max_threads.c


Index: openmp/libomptarget/deviceRTLs/nvptx/test/api/max_threads.c
===================================================================
--- openmp/libomptarget/deviceRTLs/nvptx/test/api/max_threads.c
+++ openmp/libomptarget/deviceRTLs/nvptx/test/api/max_threads.c
@@ -19,7 +19,7 @@
     { MaxThreadsL2 = omp_get_max_threads(); }
   }
 
-  // CHECK: Non-SPMD MaxThreadsL1 = 32
+  // CHECK: Non-SPMD MaxThreadsL1 = 64
   printf("Non-SPMD MaxThreadsL1 = %d\n", MaxThreadsL1);
   // CHECK: Non-SPMD MaxThreadsL2 = 1
   printf("Non-SPMD MaxThreadsL2 = %d\n", MaxThreadsL2);
Index: openmp/libomptarget/deviceRTLs/nvptx/test/api/get_max_threads.c
===================================================================
--- /dev/null
+++ openmp/libomptarget/deviceRTLs/nvptx/test/api/get_max_threads.c
@@ -0,0 +1,22 @@
+// RUN: %compile-run-and-check
+#include <omp.h>
+#include <stdio.h>
+
+int main(){
+  int max_threads = -1;
+  int num_threads = -1;
+
+  #pragma omp target map(tofrom: max_threads)
+    max_threads = omp_get_max_threads();
+
+  #pragma omp target parallel map(tofrom: num_threads)
+  {
+    #pragma omp master
+      num_threads = omp_get_num_threads();
+  }
+  
+  // CHECK: Max Threads: 128, Num Threads: 128
+  printf("Max Threads: %d, Num Threads: %d\n", max_threads, num_threads);
+
+  return 0;
+}
Index: openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
===================================================================
--- openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
+++ openmp/libomptarget/deviceRTLs/common/src/omptarget.cu
@@ -68,7 +68,7 @@
   // set number of threads and thread limit in team to started value
   omptarget_nvptx_TaskDescr *currTaskDescr =
       omptarget_nvptx_threadPrivateContext->GetTopLevelTaskDescr(threadId);
-  nThreads = GetNumberOfWorkersInTeam();
+  nThreads = GetNumberOfThreadsInBlock();
   threadLimit = ThreadLimit;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D74092.242931.patch
Type: text/x-patch
Size: 1892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/openmp-commits/attachments/20200206/c26d6567/attachment.bin>


More information about the Openmp-commits mailing list