Re: Executable on Apple M1 and Apple Intel

2021-09-29 Thread Iain Sandoe
Hello Heiner.

> On 29 Sep 2021, at 08:04, Heiner Veelken via Fortran  
> wrote:

> This is my first post; kindly inform me, if I did anything wrong :-)
> I am using gfortran (M1) from hpc.sourceforge.net 
>  on my Apple Macbook Pro M1. I just create my 
> executable via:
> 
> gfortran Pmain.f psub.F -o prog_m1
> 
> This only works on my machine. On Apple Intel Macbook Pros the response in 
> the terminal is a.o. "bad cpu type".
> Is there a possibility to create something like a "universal binary" in 
> gfortran, which works as well for M1- and Intel-CPUs? In case of, what would 
> be the option to call the compiler, how would it look like?

Yes it is possible, but I don’t know if any distribution is supplying the 
relevant compiler for gfortran.

Essentially, one needs a [cross]compiler generating Intel (x86_64) code which 
runs on the M1.

then you build your program with the native compiler => m1/my_prog
then you build your program with the cross-compiler => intel/my_prog

then you make a “FAT” version, thus:

lipo m1/my_prog intel/my_prog  -create -output fat/my_prog 

(or however you prefer to layout your work, of course)

so you’d need to see if hpc.sourceforge.net is providing a cross compiler 
targetting intel .. 
if not, then ask back here and perhaps we can suggest an alternative.

Iain.

> Remark: Is there a Fortran-guru here living in Aachen, Germany, too?




Executable on Apple M1 and Apple Intel

2021-09-29 Thread Heiner Veelken via Fortran
Dear Fortran guys!

This is my first post; kindly inform me, if I did anything wrong :-)
I am using gfortran (M1) from hpc.sourceforge.net  
on my Apple Macbook Pro M1. I just create my executable via:

gfortran Pmain.f psub.F -o prog_m1

This only works on my machine. On Apple Intel Macbook Pros the response in the 
terminal is a.o. "bad cpu type".
Is there a possibility to create something like a "universal binary" in 
gfortran, which works as well for M1- and Intel-CPUs? In case of, what would be 
the option to call the compiler, how would it look like?

Remark: Is there a Fortran-guru here living in Aachen, Germany, too?