diff mbox series

[wwwdocs] gcc-14/changes.htm - Offloading: -lm/-lgfortran is autolinked

Message ID 675b9052-5688-6079-2300-86e51f7939b1@codesourcery.com
State New
Headers show
Series [wwwdocs] gcc-14/changes.htm - Offloading: -lm/-lgfortran is autolinked | expand

Commit Message

Tobias Burnus June 16, 2023, 1:43 p.m. UTC
Thomas recently improved the offload experience by avoiding to use, e.g.

   gfortran -O3 -fopenmp qcd.f90 -lblas -foffload-options="-lgfortran -lm"

as libm and libgfortran now automatically get linked as 'gfortran' links
-lgfortran and -lm on the host (only those libraries, not others). Thus,
the commandline now looks much more natural:

   gfortran -O3 -fopenmp qcd.f90 -lblas

→ https.//gcc.gnu.org/r14-1807-g4bcb46b3ade179 for the code change.

Attached patch documents it in the release notes.
I loved to hear comments, suggestions, improvements (or even appraisals).

If not, I just will commit it eventually as is - and it has to be improved
later on ...

Tobias
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

Comments

Gerald Pfeifer June 16, 2023, 4:24 p.m. UTC | #1
On Fri, 16 Jun 2023, Tobias Burnus wrote:
> Thomas recently improved the offload experience by avoiding to use, e.g.
> 
>   gfortran -O3 -fopenmp qcd.f90 -lblas -foffload-options="-lgfortran -lm"
> 
> as libm and libgfortran now automatically get linked as 'gfortran' links
> -lgfortran and -lm on the host (only those libraries, not others). Thus,
> the commandline now looks much more natural:
> 
>   gfortran -O3 -fopenmp qcd.f90 -lblas

Nice!

> Attached patch documents it in the release notes.
> I loved to hear comments, suggestions, improvements (or even appraisals).

Looks good to me. (Personally I would have written "the math and 
Fortran runtime libraries", which is shorter, but pretty much a matter 
of preference. IOW, keep it as is unless you like it better, too. :-)

One idea might be to show the two invocations - before and after - in the 
release notes as well, at the end of that new entry. Totally up to you, 
too.


For the benefit of the doubt: Okay, thank you!

Gerald
diff mbox series

Patch

gcc-14/changes.htm - Offloading: -lm/-lgfortran is autolinked

diff --git a/htdocs/gcc-14/changes.html b/htdocs/gcc-14/changes.html
index c403c94f..96653f05 100644
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -51,6 +51,15 @@  a work-in-progress.</p>
       was extended.
     </li>
   </ul>
+  </li>
+  <li>For offload-device code generated via OpenMP and OpenACC, the math
+      library and the Fortran runtime library will now automatically be linked,
+      when the user or compiler links them on the host side. Thus, it is no
+      longer required to explicitly pass <code>-lm</code> and/or
+      <code>-lgfortran</code> to the offload-device linker using the <a
+      href="https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-foffload-options"
+      ><code>-foffload-options=</code></a> flag.
+  </li>
 </ul>
 <!-- .................................................................. -->
 <h2 id="languages">New Languages and Language specific improvements</h2>