compiler flag question
  Home FAQ Contact Sign in
comp.lang.fortran only
 
Advanced search
POPULAR GROUPS

more...

comp.lang.fortran Profile…
 Up
compiler flag question         


Author: tomguest
Date: Aug 20, 2008 05:37

Hi

How can I make my code do something depending on my compiler flag?
For example, if I use the -openmp flag I want a loop to have a
different range.

i.e.

if (flag -openmp)
do i=1,10
else
do i=1,5
endif

do loop

enddo

Thanks
12 Comments
Re: compiler flag question         


Author: Tim Prince
Date: Aug 20, 2008 07:32

tomguest@hotmail.com wrote:
> Hi
>
> How can I make my code do something depending on my compiler flag?
> For example, if I use the -openmp flag I want a loop to have a
> different range.
>
> i.e.
>
> if (flag -openmp)
> do i=1,10
> else
> do i=1,5
> endif
>
> do loop
>
> enddo
Show full article (0.38Kb)
no comments
Re: compiler flag question         


Author: tomguest
Date: Aug 20, 2008 07:52

cheers for the help.
no comments
Re: compiler flag question         


Author: glen herrmannsfeldt
Date: Aug 20, 2008 13:42

tomguest@hotmail.com wrote:
> How can I make my code do something depending on my compiler flag?
> For example, if I use the -openmp flag I want a loop to have a
> different range.
> if (flag -openmp)
> do i=1,10
> else
> do i=1,5
> endif

You can't do that in Fortran, or pretty much any
compiled language. (I have seen it done in BASIC).

But you say compiler flag. If you use the C preprocessor,
you can do

#ifdef OPENMP
do i=1,10
#else
do i=1,5
#endif
Show full article (0.66Kb)
no comments
Re: compiler flag question         


Author: Ron Ford
Date: Aug 20, 2008 18:23

On Wed, 20 Aug 2008 12:42:03 -0800, glen herrmannsfeldt posted:
Show full article (0.96Kb)
no comments
Re: compiler flag question         


Author: tju329
Date: Aug 20, 2008 21:15

On Aug 20, 8:37 pm, tomgu...@hotmail.com wrote:
> Hi
>
> How can I make my code do something depending on my compiler flag?
> For example, if I use the -openmp flag I want a loop to have a
> different range.
>
> i.e.
>
> if (flag -openmp)
>   do i=1,10
> else
>   do i=1,5
> endif
>
> do loop
>
> enddo
>
> Thanks ...
Show full article (0.45Kb)
no comments
Re: compiler flag question         


Author: Arjen Markus
Date: Aug 21, 2008 00:07

On 21 aug, 03:23, Ron Ford wrote:
> On Wed, 20 Aug 2008 12:42:03 -0800, glen herrmannsfeldt posted:
>
>
>
>
>
>> tomgu...@hotmail.com wrote:
>
>>> How can I make my code do something depending on my compiler flag?
>>> For example, if I use the -openmp flag I want a loop to have a
>>> different range.
>
>>> if (flag -openmp)
>>>   do i=1,10
>>> else
>>>   do i=1,5
>>> endif
>
>> You can't do that in Fortran, or pretty much any ...
Show full article (1.26Kb)
no comments
Re: compiler flag question         


Author: Arjen Markus
Date: Aug 21, 2008 00:08

On 20 aug, 14:37, tomgu...@hotmail.com wrote:
> Hi
>
> How can I make my code do something depending on my compiler flag?
> For example, if I use the -openmp flag I want a loop to have a
> different range.
>
> i.e.
>
> if (flag -openmp)
>   do i=1,10
> else
>   do i=1,5
> endif
>
> do loop
>
> enddo
>
> Thanks ...
Show full article (0.51Kb)
no comments
Re: compiler flag question         


Author: Reinhold Bader
Date: Aug 21, 2008 02:03

How about

imax = 5
!$ imax = 10
do i=1, imax
:
end do

Regards
Show full article (0.39Kb)
no comments
Re: compiler flag question         


Author: tomguest
Date: Aug 21, 2008 02:59

I basically want to have different output to certain files depending
on how the user compiles the code.

I just gave the loop problem as an example. I'm also incorporating
some other features that I want to enable by compiler flags.
no comments

RELATED THREADS
SubjectArticles qty Group
FS: Banner Flag Flag 3'x 5' Washington Nationals - Item #: 395261 via auctionalt.marketplace.online.ebay ·
1 2