Problems with mac os lion and openmp

Discussion in 'Mac Programming' started by jalonso, Mar 1, 2012.

  1. macrumors newbie

    #1
    Hello all,

    I am getting my way around openmp and I get the following error when I compile using either ifort or gfortran

    Undefined symbols for architecture x86_64:
    "_MAIN__", referenced from:
    _main in for_main.o
    ld: symbol(s) not found for architecture x86_64
    sh_mxvp.sh: line 5: 1021 Illegal instruction: 4 ./myprog

    This is the program

    SUBROUTINE mxvp(m,n,a,b,c)
    IMPLICIT NONE
    INTEGER, INTENT(IN) :: m,n
    REAL, INTENT(INOUT) :: a(m)
    REAL, INTENT(IN) :: b(m,n),c(n)
    INTEGER :: i,j
    !$OMP PARALLEL DO DEFAULT(NONE) &
    !$OMP SHARED(m,n,a,b,c) PRIVATE(i,j)
    DO i=1,m
    a(i)=0.0
    DO j=1,n
    a(i)=a(i)+b(i,j)*c(j)
    END DO
    END DO
    !$OMP END PARALLEL DO
    END SUBROUTINE mxvp

    And these are the .sh files

    gfortran -fopenmp -c mxvp.f90
    gfortran -fopenmp -o myprog mxvp.o

    ./myprog

    ifort -fopenmp -c mxvp.f90
    ifort -fopenmp -o myprog mxvp.o

    ./myprog

    I already tried to add -m64 and/or -arch x86_64

    Thank you all in advance
     

Share This Page