GCC 13.2.0 compilation of simple C code that includes offloading to NVIDIA GPU fails
Binary Version: GCC 13.2.0 (with POSIX threads) + LLVM/Clang/LLD/LLDB 17.0.6 + MinGW-w64 11.0.1 (UCRT) - release 5 (LATEST) for win64
Compilation command: gcc -lm -g -Wall -fopenmp -foffload=nvptx-none sum.c -o sum.exe
Compilation error: lto-wrapper.exe: fatal error: could not find accel/nvptx-none/mkoffload in C:/tmp/mingw64/bin/../libexec/gcc/x86_64-w64-mingw32/13.2.0/;C:/tmp/mingw64/bin/../libexec/gcc/;C:/tmp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ (consider using '-B') compilation terminated. C:/tmp/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: error: lto-wrapper failed collect2.exe: error: ld returned 1 exit status
C code:
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <omp.h>
int main(int argc, char *argv[]) {
long long int j, largeN;
double sum = 0.0;
clock_t tstart, tend;
int num_dev;
num_dev = omp_get_num_devices();
printf("%d\n", num_dev);
largeN = (long long int) atoll(argv[1]);
printf("Large Number = %lld\n", largeN);
tstart = clock();
#pragma omp parallel for private(j) reduction(+:sum)
for(j=1; j<largeN; j++) {
sum += (double) (1.0/j);
}
tend = clock();
printf("Sum [1, ... , %lld] = %.6f\n", largeN, sum);
printf("\nCompleted in %.2f seconds%45s\n\n", ( (double) (tend - tstart) ) / CLOCKS_PER_SEC, "");
sum = 0.0;
tstart = clock();
#pragma omp target map(to:largeN) map(tofrom:sum)
#pragma omp parallel for simd private(j) reduction(+:sum)
for (j=1; j<largeN; j++) {
sum += (double) (1.0/j);
}
tend = clock();
printf("Sum [1, ... , %lld] = %.6f\n", largeN, sum);
printf("\nCompleted in %.2f seconds%45s\n\n", ( (double) (tend - tstart) ) / CLOCKS_PER_SEC, "");
return(0);
}
A remedy would be greatly appreciated.
I have not been able to build GCC nvptx offloading since 10.3.0.
Unfortunately I never found enough time to deepdive into why exactly it won't build.
Many thanks for the response, Brecht. I fully understand the time constraints.
Demetrios
From: Brecht Sanders @.> Sent: Monday, March 4, 2024 11:28 AM To: brechtsanders/winlibs_mingw @.> Cc: Gatziolis, Demetrios - FS, OR @.>; Author @.> Subject: Re: [brechtsanders/winlibs_mingw] GCC 13.2.0 compilation of simple C code that includes offloading to NVIDIA GPU fails (Issue #184)
I have not been able to build GCC nvptx offloading since 10.3.0.
Unfortunately I never found enough time to deepdive into why exactly it won't build.
Reply to this email directly, view it on GitHubhttps://github.com/brechtsanders/winlibs_mingw/issues/184#issuecomment-1977304069, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A6FSJW3I52IQTCYVTAGJLETYWTDLDAVCNFSM6AAAAABD5PVQF2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZXGMYDIMBWHE. You are receiving this because you authored the thread.Message ID: @.@.>>
This electronic message contains information generated by the USDA solely for the intended recipients. Any unauthorized interception of this message or the use or disclosure of the information it contains may violate the law and subject the violator to civil or criminal penalties. If you believe you have received this message in error, please notify the sender and delete the email immediately.