<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: C function vs Fortran function performance in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896384#M79732</link>
    <description>&lt;DIV style="margin:0px;"&gt;In my opinion, it all depends from the model you want to realize.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;If your model can be just expressed in matrix terms, then nothing beats fortran efficency and expressivity.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;In all other casesC++ is the best choice.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;Just to give a more concrete example: if I want to model a soft computing technique like, for example, a neuro-fuzzy engine to process certain data, I would surely use C++. Would I need to realize a code for a fluid dynamics simulator using pseudospectral methods, I would surely use Fortran.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;Best thing isthat, as already underlined, using F2003 ISO_C modules you have full interoperability between languages, so it's common for me to call C++ routines from Fortran programs and vice versa (just remember to declare C++ "entrance" points as "extern "C"" sinceISO_C is designed to manage interoperability withC) without sacrifying portability.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Nov 2008 06:38:01 GMT</pubDate>
    <dc:creator>Antonio_M</dc:creator>
    <dc:date>2008-11-27T06:38:01Z</dc:date>
    <item>
      <title>C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896378#M79726</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Not trying to start a language war or anything, but I work in a real-time image processing industry where performance is of utmost concern.&lt;/P&gt;
&lt;P&gt;Our initial algorithms were written in Fortran back in the 70's/80's, and eventually translated to C. Right now our application uses C++ for infrastructure-related stuff, and C for the algorithms for maximum performance. The C algorithm functions are parallelized using master-worker design pattern. We use Intel compiler. Our platform is Windows x64.&lt;/P&gt;
&lt;P&gt;I have never coded in Fortran but heard that it's great for scientific computing, as well as unmatched (?) performance by other language.&lt;/P&gt;
&lt;P&gt;So...here's the question: assuming an algorithm is coded efficiently in C and Fortran (i.e. they both describe the same algorithm), would code produced in Fortran be significantly faster than the C counterpart? Assuming that we use Intel compiler for both C and Fortran.&lt;/P&gt;
&lt;P&gt;Because if Fortran really is faster, I'm thinking about making an object code out of Fortran and call it from our C++ infrastructure instead.&lt;/P&gt;
&lt;P&gt;Thanks!!&lt;/P&gt;
&lt;P&gt;S.&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2008 23:33:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896378#M79726</guid>
      <dc:creator>shachris23</dc:creator>
      <dc:date>2008-11-24T23:33:37Z</dc:date>
    </item>
    <item>
      <title>Re: C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896379#M79727</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/316053"&gt;shachris23&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Not trying to start a language war or anything, but I work in a real-time image processing industry where performance is of utmost concern.&lt;/P&gt;
&lt;P&gt;Our initial algorithms were written in Fortran back in the 70's/80's, and eventually translated to C. Right now our application uses C++ for infrastructure-related stuff, and C for the algorithms for maximum performance. The C algorithm functions are parallelized using master-worker design pattern. We use Intel compiler. Our platform is Windows x64.&lt;/P&gt;
&lt;P&gt;I have never coded in Fortran but heard that it's great for scientific computing, as well as unmatched (?) performance by other language.&lt;/P&gt;
&lt;P&gt;So...here's the question: assuming an algorithm is coded efficiently in C and Fortran (i.e. they both describe the same algorithm), would code produced in Fortran be significantly faster than the C counterpart? Assuming that we use Intel compiler for both C and Fortran.&lt;/P&gt;
&lt;P&gt;Because if Fortran really is faster, I'm thinking about making an object code out of Fortran and call it from our C++ infrastructure instead.&lt;/P&gt;
&lt;P&gt;Thanks!!&lt;/P&gt;
&lt;P&gt;S.&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;It's hard to tell &lt;EM&gt;a priori&lt;/EM&gt;. Modern C (as distinct from C++) and Fortran are comparably fast and which you use can be a personal choice unless local policy dictates otherwise. I'm surrounded by Ccolleagues but Iprefer that all my bugs be of the Fortran type if only because I can detect and swat them more easily. Fortran is simple to learn and you can quickly recode a C algorithm and see which is faster (for that algorithm only and assuming both codes are equally well written). Did you know that Fortran 2003 is interoperable with C?&lt;/P&gt;
&lt;P&gt;Gerry&lt;/P&gt;</description>
      <pubDate>Mon, 24 Nov 2008 23:58:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896379#M79727</guid>
      <dc:creator>g_f_thomas</dc:creator>
      <dc:date>2008-11-24T23:58:45Z</dc:date>
    </item>
    <item>
      <title>Re: C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896380#M79728</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/379158"&gt;g.f.thomas&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;P&gt;It's hard to tell &lt;EM&gt;a priori&lt;/EM&gt;. Modern C (as distinct from C++) and Fortran are comparably fast and which you use can be a personal choice unless local policy dictates otherwise. I'm surrounded by Ccolleagues but Iprefer that all my bugs be of the Fortran type if only because I can detect and swat them more easily. Fortran is simple to learn and you can quickly recode a C algorithm and see which is faster (for that algorithm only and assuming both codes are equally well written). Did you know that Fortran 2003 is interoperable with C?&lt;/P&gt;
&lt;P&gt;Gerry&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;Oh wow..I never knew modern Fortran is interoperable with C. Just now I also looked up about Fortran on Wikipedia and found that the language is going through a lot of change to support parallelism. How great!&lt;/P&gt;
&lt;P&gt;Interesting. Thanks for your thoughts.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2008 18:10:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896380#M79728</guid>
      <dc:creator>shachris23</dc:creator>
      <dc:date>2008-11-25T18:10:09Z</dc:date>
    </item>
    <item>
      <title>Re: C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896381#M79729</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;P&gt;The main differences are&lt;/P&gt;
&lt;P&gt;one compiler may simply be better, or better adapted to your particular situation, than the other.&lt;/P&gt;
&lt;P&gt;the fortran library is likely to be better tuned for many mathematical operations -- but you can call it from C if you want.&lt;/P&gt;
&lt;P&gt;the fortran language permits the compiler to make certain optimizations that are seldom possible in standard C / C++, mainly due to potential aliasing but also to potential recursion / reentrancy issues. It is usually possible to provide "hints" to a performance-oriented C / C++ compiler that will allow it to make the same optimizations.&lt;/P&gt;
&lt;P&gt;In the end, in my opinion, it is easier to express and understand algorithms that involve more advanced data structures in C / C++ than in the fortran that I learned. Modern fortran may be better but it still feels very combersome to me. Since better algorithms beat better code every time, use the language that admits the most natural and most maintainable expression of the algorithm.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2008 18:12:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896381#M79729</guid>
      <dc:creator>Steve_Nuchia</dc:creator>
      <dc:date>2008-11-25T18:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896382#M79730</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/265453"&gt;Steve Nuchia&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;P&gt;The main differences are&lt;/P&gt;
&lt;P&gt;one compiler may simply be better, or better adapted to your particular situation, than the other.&lt;/P&gt;
&lt;P&gt;the fortran library is likely to be better tuned for many mathematical operations -- but you can call it from C if you want.&lt;/P&gt;
&lt;P&gt;the fortran language permits the compiler to make certain optimizations that are seldom possible in standard C / C++, mainly due to potential aliasing but also to potential recursion / reentrancy issues. It is usually possible to provide "hints" to a performance-oriented C / C++ compiler that will allow it to make the same optimizations.&lt;/P&gt;
&lt;P&gt;In the end, in my opinion, it is easier to express and understand algorithms that involve more advanced data structures in C / C++ than in the fortran that I learned. Modern fortran may be better but it still feels very combersome to me. Since better algorithms beat better code every time, use the language that admits the most natural and most maintainable expression of the algorithm.&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;I agree with your assertion there. I believe the language that can best solve the given problem should be used.&lt;/P&gt;
&lt;P&gt;By the way, let's say if someone use Fortran with CC++ code, how does one go about debugging it? So if we called a Fortan code from C...how does one go about "stepping into" Fortran code if needed be?&lt;/P&gt;
&lt;P&gt;My environment is Windows Visual Studio C++.&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;S.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2008 21:58:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896382#M79730</guid>
      <dc:creator>shachris23</dc:creator>
      <dc:date>2008-11-25T21:58:01Z</dc:date>
    </item>
    <item>
      <title>Re: C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896383#M79731</link>
      <description>&lt;DIV style="margin:0px;"&gt;
&lt;DIV id="quote_reply" style="width: 100%; margin-top: 5px;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/316053"&gt;shachris23&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;P&gt;I agree with your assertion there. I believe the language that can best solve the given problem should be used.&lt;/P&gt;
&lt;P&gt;By the way, let's say if someone use Fortran with CC++ code, how does one go about debugging it? So if we called a Fortan code from C...how does one go about "stepping into" Fortran code if needed be?&lt;/P&gt;
&lt;P&gt;My environment is Windows Visual Studio C++.&lt;/P&gt;
&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;P&gt;Just do it. It works just as if you stepped into a C routine.&lt;/P&gt;
&lt;P&gt;My philosophy on these language wars is that you should choose the language that makes the most sense for that aspect of the application, that you know well and that can be maintained by your organization. No matter how good Fortran is, it's a poor choice if it has to be maintained by people who know only C++. Every language has its strengths and weaknesses. Historically, C/C++ has been weak in array operations compared to Fortran. That's still largely true, but some of the performance issues can be remedied by use of new features such as accelerated valarray.&lt;/P&gt;
&lt;P&gt;Modern Fortran is very expressive and does not lack any significant features compared to usable C++. I'll comment that there have been many studies of projects that settled on C++ - the studies found that a majority of these projects never got completed or finished late and had significant maintenance costs. This is more likely to happen when developers are given free reign of all the C+ features and mis-features. Fortran does not have this characteristic.&lt;/P&gt;</description>
      <pubDate>Tue, 25 Nov 2008 22:38:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896383#M79731</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2008-11-25T22:38:49Z</dc:date>
    </item>
    <item>
      <title>Re: C function vs Fortran function performance</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896384#M79732</link>
      <description>&lt;DIV style="margin:0px;"&gt;In my opinion, it all depends from the model you want to realize.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;If your model can be just expressed in matrix terms, then nothing beats fortran efficency and expressivity.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;In all other casesC++ is the best choice.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;Just to give a more concrete example: if I want to model a soft computing technique like, for example, a neuro-fuzzy engine to process certain data, I would surely use C++. Would I need to realize a code for a fluid dynamics simulator using pseudospectral methods, I would surely use Fortran.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;Best thing isthat, as already underlined, using F2003 ISO_C modules you have full interoperability between languages, so it's common for me to call C++ routines from Fortran programs and vice versa (just remember to declare C++ "entrance" points as "extern "C"" sinceISO_C is designed to manage interoperability withC) without sacrifying portability.&lt;/DIV&gt;
&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Nov 2008 06:38:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/C-function-vs-Fortran-function-performance/m-p/896384#M79732</guid>
      <dc:creator>Antonio_M</dc:creator>
      <dc:date>2008-11-27T06:38:01Z</dc:date>
    </item>
  </channel>
</rss>

