[threads smoke test]-Added clang version logic. Clang 9 now considers this to be SPMD instead of Generic (Clang 8)
#include <stdio.h>
#include <omp.h>
#include <string.h>
+#include <stdlib.h>
+/*Starting with clang version 9 this test is considered to be SPMD mode. Previously, clang 8 considered this to be generic,
+so now this test determines the clang version to verify the results.*/
int main()
{
+ FILE * file;
+ char ln[256];
+
+ //Default Clang version set to 8
+ int clangVersion = 8;
+
+ //Determine which Clang version
+ system("$AOMP/bin/clang --version > clang.txt");
+ file = fopen("clang.txt", "r");
+ if (!file)
+ printf("Clang version file not found!\n");
+ else{
+ char *found = NULL;
+ while((fgets(ln, 256, file) != NULL)){
+ found = strstr(ln, "9.");
+ if(found){
+ clangVersion = 9;
+ printf("Clang version: %s\n", found);
+ break;
+ }
+ }
+ }
+ fclose(file);
+ system("rm clang.txt");
//Determine which GPU type (NVIDIA or AMD)
char* nvidia= "sm";
char* aomp_gpu= getenv("AOMP_GPU");
@@ -13,9 +40,10 @@ int main()
if(aomp_gpu && strstr(aomp_gpu, nvidia) != NULL)
isAMDGPU = 0;
- if(isAMDGPU)
+ if(isAMDGPU && clangVersion < 9)
masterWarpThread = 959;
- else
+
+ if(!isAMDGPU)
masterWarpThread = 991;
int thread_id[1024] ;
@@ -34,11 +62,15 @@ int main()
maxThrd = thread_id[i];
}
printf("Max thread id %d\n", maxThrd);
- if (maxThrd == masterWarpThread) {
+ if (maxThrd == masterWarpThread && clangVersion < 9) {
+ printf("Passed\n");
+ return 0;
+ } else if (maxThrd == 1023 && clangVersion > 8){
printf("Passed\n");
return 0;
} else{
printf("Failed\n");
return 1;
+
}
}
