Re: [Anl-intel-csa] building a mix of C and Fortran files (file not recognized: File truncated clang-6.0: error: csa-ld command failed with exit code 1 (use -v to see invocation))
To expand on Ravi's answer, you need to add the OpenMP options to all of the compilations. When OpenMP is used, the link step is assuming that all of the objects are "bundles" - files that contain multiple objects. The error is caused when the link step attempts to extract an object from the bundle, and it fails because some of the file simple objects, not bundles. The result is an empty .o, which causes the linker to give the "file not recognized: File truncated" error. The other workaround is to put the OpenMP code into a shared object, and link the main program against that shared object. All of the files built into the shared object need to be compiled and linked with the OpenMP options, but the main program does not. See $CSA_TOP/samples/omp-offload/shared-obj-demo for an example. From: anl-intel-csa [mailto:[email protected]] On Behalf Of Narayanaswamy, Ravi Sent: Tuesday, March 27, 2018 3:58 PM To: Jin, Zheming <[email protected]>; [email protected] Subject: Re: [Anl-intel-csa] building a mix of C and Fortran files (file not recognized: File truncated clang-6.0: error: csa-ld command failed with exit code 1 (use -v to see invocation)) You are adding -fopenmp -fopenmp-target=csa only in the link phase. Need to add it compilation phase also. Ravi From: anl-intel-csa [mailto:[email protected]] On Behalf Of Jin, Zheming Sent: Tuesday, March 27, 2018 12:53 PM To: [email protected]<mailto:[email protected]> Subject: [Anl-intel-csa] building a mix of C and Fortran files (file not recognized: File truncated clang-6.0: error: csa-ld command failed with exit code 1 (use -v to see invocation)) The location of the test is /soft/restricted/intel_csa/apps/benchmark/sw4lite/tests/testil. It has standalone tests. You can type 'make' in that directory. "CSA_OPTS := -fopenmp -fopenmp-targets=csa -lm" doesn't work and produces the error at the bottom of the email. Do you know what needs to be changed in the Makefile to fix the error ? Thanks, zheming /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o rhs4th3fortsgstr.o rhs4th3fortsgstr.f /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o boundaryOp.o boundaryOp.f /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o curvilinear4sg.o curvilinear4sg.f /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o metric.o metric.f /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o addsgd4.o addsgd4.f /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o rhs4sg.o rhs4sg.c /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o rhs4sg_rev.o rhs4sg_rev.c /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang -c -o gettimec.o gettimec.c /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o grid-utilities.o grid-utilities.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o rhs4sgcurv.o rhs4sgcurv.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o rhs4sgcurv_rev.o rhs4sgcurv_rev.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o metricC.o metricC.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o addsgd4fort.o addsgd4fort.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o addsgd4fort_rev.o addsgd4fort_rev.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -c -o testil.o testil.C /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/install/bin/clang++ -o main -O3 -fopenmp -fopenmp-targets=csa -lm -L /soft/restricted/intel_csa/comp/tools/2018-02-21-release/tools/local/lib rhs4th3fortsgstr.o boundaryOp.o curvilinear4sg.o metric.o addsgd4.o rhs4sg.o rhs4sg_rev.o gettimec.o grid-utilities.o rhs4sgcurv.o rhs4sgcurv_rev.o metricC.o addsgd4fort.o addsgd4fort_rev.o testil.o /tmp/rhs4th3fortsgstr-46789e.o: file not recognized: File truncated clang-6.0: error: csa-ld command failed with exit code 1 (use -v to see invocation)
participants (1)
-
Tannenbaum, Barry M