PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

CUDA-x86.

Using PGI for compiling Matlab Executables (MEX) from C++.
Goto page Previous  1, 2
 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
Haakon



Joined: 18 Mar 2014
Posts: 10

PostPosted: Wed Mar 26, 2014 10:13 am    Post subject: New try, on LINUX Ubuntu 12 Reply with quote

I have now made a setup on linux with the following mex-options and linking line.
Maybe it is easier to figure out how to do this on Linux. I run PGI 14.1 and Matlab 2013a on my Ubuntu 12.

Still the linking with the absence of main() is the problem.
Quote:


-> mexopts.sh sourced from directory (DIR = .)
FILE = /home/haakon/Dropbox/NTNU/Masteroppgave/Propose_MAC_test/Sinc_test/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2013a
-> CC = /opt/pgi/linux86-64/14.3/bin/pgcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fpic -Mframe -mp
CDEBUGFLAGS = -g
COPTIMFLAGS = -O3
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lstdc++
arguments = -DMX_COMPAT_32
-> CXX = /opt/pgi/linux86-64/14.3/bin/pgcpp
-> CXX flags:
CXXFLAGS = -Mframe -mp
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O3 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fbackslash -fpic -Mframe
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O3
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat
arguments = -DMX_COMPAT_32
-> LD = /opt/pgi/linux86-64/14.3/bin/pgcpp
-> Link flags:
LDFLAGS = -Bdynamic -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

/usr/local/MATLAB/R2013a/bin/mex: 305: /usr/local/MATLAB/R2013a/bin/mex: /opt/pgi/linux86-64/14.3/bin/pgcc: not found

Warning: You are using gcc version "". The version
currently supported with MEX is "4.4.x".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

-> /opt/pgi/linux86-64/14.3/bin/pgcpp -c -I/usr/local/MATLAB/R2013a/extern/include -I/usr/local/MATLAB/R2013a/simulink/include -DMATLAB_MEX_FILE -Mframe -mp -DMX_COMPAT_32 -O3 -DNDEBUG "helloMEX.cpp"

-> /opt/pgi/linux86-64/14.3/bin/pgcpp -O -Bdynamic -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "helloMEX.mexa64" helloMEX.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat

/usr/lib/x86_64-linux-gnu/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'

mex: link of ' "helloMEX.mexa64"' failed.

Error using mex (line 206)
Unable to complete successfully.

>>


I don't know the reason for all the various linking flags, as they are set using the gcc version of the mexopts.sh file as a basis. From this default gcc setup i had to remove the following CXXFLAGS:
Code:

pgcpp-Error-Unknown switch: -fno-omit-frame-pointer
pgcpp-Error-Unknown switch: -pthread

This made the compiler run, and give the error msg. above. I suspect that I may need a PGI equivalent to theese two switches or something similar. Hope someone has a clue, as it would be wery interesting to compare OpenACC to OpenMP in my thesis.

Is there any Linux equivalent to the "__declspec(dllexport)" suggested earlier in this threas (using windows).
Back to top
View user's profile
cparrott



Joined: 02 May 2011
Posts: 146

PostPosted: Wed Mar 26, 2014 1:57 pm    Post subject: Reply with quote

Haakon,

The equivalent PGI option to -fomit-frame-pointer is -Mnoframe.

THe -pthread flag in GCC is just a convenience flag that automatically pulls in the header files and libraries for POSIX threads. For PGI, I believe you can get away with just adding -lpthread to the list of libraries to link. You might even be able to get away with omitting this altogether, unless the code you are compiling uses POSIX threads.

As for the main() problem (pardon the pun!) - you need to pass the -shared flag to pgcc. pgcc, in turn, will pass this flag to ld (the GNU linker). This tells ld to link the objects as a shared library, and not a standalone executable. I believe this is what Matlab is expecting.

Hope this helps,

+chris
Back to top
View user's profile
Haakon



Joined: 18 Mar 2014
Posts: 10

PostPosted: Thu Mar 27, 2014 9:10 am    Post subject: This helped. Reply with quote

Thank you.

The -Mnoframe switch moved me forward a bit. A new error concerning the libstdc++ appears and including the -shared switch still gives the same error.
Quote:
-> /opt/pgi/linux86-64/14.3/bin/pgc++ -O3 -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "helloMEX.mexa64" helloMEX.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm

/usr/bin/ld: cannot find -lstdc++


When i tride to include the PGI path -L/opt/pgi/linux86-64/14.3/lib (to tell the compiler where to look for libstdc++), an additional error that propts for the -fpic switch appears (which is already turned on but apparently is beeing ignored). This error only appears when both the PGI lib path is included, and -shared is turned on:

Quote:

/usr/bin/ld: /opt/pgi/linux86-64/14.3/lib/libpgmp.a(preinit2.o): relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/opt/pgi/linux86-64/14.3/lib/libpgmp.a: could not read symbols: Bad value


Full recipts are included below, first without the -shared switch but with -L/opt/pgi/linux86-64/14.3/lib included (this path seem to make no difference) :
Quote:


-> mexopts.sh sourced from directory (DIR = .)
FILE = /home/haakon/Dropbox/NTNU/Masteroppgave/Propose_MAC_test/Sinc_test/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2013a
-> CC = /opt/pgi/linux86-64/14.3/bin/pgcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fpic -Mnoframe -mp
CDEBUGFLAGS = -g
COPTIMFLAGS = -O3
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat
arguments = -DMX_COMPAT_32
-> CXX = /opt/pgi/linux86-64/14.3/bin/pgc++
-> CXX flags:
CXXFLAGS = -Mnoframe -fPIC -largeArrayDims
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O3 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -L/opt/pgi/linux86-64/14.3/lib
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fbackslash -fpic -Mnoframe -pthread
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O3
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = /opt/pgi/linux86-64/14.3/bin/pgc++
-> Link flags:
LDFLAGS = -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O3
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

/usr/local/MATLAB/R2013a/bin/mex: 305: /usr/local/MATLAB/R2013a/bin/mex: /opt/pgi/linux86-64/14.3/bin/pgcc: not found

Warning: You are using gcc version "". The version
currently supported with MEX is "4.4.x".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -c -I/usr/local/MATLAB/R2013a/extern/include -I/usr/local/MATLAB/R2013a/simulink/include -DMATLAB_MEX_FILE -Mnoframe -fPIC -largeArrayDims -DMX_COMPAT_32 -O3 -DNDEBUG "helloMEX.cpp"

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -O3 -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "helloMEX.mexa64" helloMEX.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -L/opt/pgi/linux86-64/14.3/lib

/usr/bin/ld: cannot find -lstdc++

mex: link of ' "helloMEX.mexa64"' failed.

Including the -shared switch gives me additional errors:

Quote:

-> mexopts.sh sourced from directory (DIR = .)
FILE = /home/haakon/Dropbox/NTNU/Masteroppgave/Propose_MAC_test/Sinc_test/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2013a
-> CC = /opt/pgi/linux86-64/14.3/bin/pgcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fpic -Mnoframe -mp
CDEBUGFLAGS = -g
COPTIMFLAGS = -O3
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat
arguments = -DMX_COMPAT_32
-> CXX = /opt/pgi/linux86-64/14.3/bin/pgc++
-> CXX flags:
CXXFLAGS = -Mnoframe -fPIC -largeArrayDims
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O3 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -L/opt/pgi/linux86-64/14.3/lib
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fbackslash -fpic -Mnoframe -pthread
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O3
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = /opt/pgi/linux86-64/14.3/bin/pgc++
-> Link flags:
LDFLAGS = -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O3
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

/usr/local/MATLAB/R2013a/bin/mex: 305: /usr/local/MATLAB/R2013a/bin/mex: /opt/pgi/linux86-64/14.3/bin/pgcc: not found

Warning: You are using gcc version "". The version
currently supported with MEX is "4.4.x".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -c -I/usr/local/MATLAB/R2013a/extern/include -I/usr/local/MATLAB/R2013a/simulink/include -DMATLAB_MEX_FILE -Mnoframe -fPIC -largeArrayDims -DMX_COMPAT_32 -O3 -DNDEBUG "helloMEX.cpp"

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -O3 -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "helloMEX.mexa64" helloMEX.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -L/opt/pgi/linux86-64/14.3/lib

/usr/bin/ld: cannot find -lstdc++
/usr/bin/ld: /opt/pgi/linux86-64/14.3/lib/libpgmp.a(preinit2.o): relocation R_X86_64_32S against `.bss' can not be used when making a shared object; recompile with -fPIC
/opt/pgi/linux86-64/14.3/lib/libpgmp.a: could not read symbols: Bad value

mex: link of ' "helloMEX.mexa64"' failed.

Error using mex (line 206)
Unable to complete successfully.

Running without giving the PGI lib path, and leaving the -shared switch on gives the same error as the first test (with path + Mnoframe, but no -shared switch):
Quote:

-> mexopts.sh sourced from directory (DIR = .)
FILE = /home/haakon/Dropbox/NTNU/Masteroppgave/Propose_MAC_test/Sinc_test/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2013a
-> CC = /opt/pgi/linux86-64/14.3/bin/pgcc
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fpic -Mnoframe -mp
CDEBUGFLAGS = -g
COPTIMFLAGS = -O3
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat
arguments = -DMX_COMPAT_32
-> CXX = /opt/pgi/linux86-64/14.3/bin/pgc++
-> CXX flags:
CXXFLAGS = -Mnoframe -fPIC -largeArrayDims
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O3 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fbackslash -fpic -Mnoframe -pthread
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O3
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = /opt/pgi/linux86-64/14.3/bin/pgc++
-> Link flags:
LDFLAGS = -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O3
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

/usr/local/MATLAB/R2013a/bin/mex: 305: /usr/local/MATLAB/R2013a/bin/mex: /opt/pgi/linux86-64/14.3/bin/pgcc: not found

Warning: You are using gcc version "". The version
currently supported with MEX is "4.4.x".
For a list of currently supported compilers see:
http://www.mathworks.com/support/compilers/current_release/

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -c -I/usr/local/MATLAB/R2013a/extern/include -I/usr/local/MATLAB/R2013a/simulink/include -DMATLAB_MEX_FILE -Mnoframe -fPIC -largeArrayDims -DMX_COMPAT_32 -O3 -DNDEBUG "helloMEX.cpp"

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -O3 -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "helloMEX.mexa64" helloMEX.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm

/usr/bin/ld: cannot find -lstdc++

mex: link of ' "helloMEX.mexa64"' failed.

Error using mex (line 206)
Unable to complete successfully.

I am still kind of lost. Sorry if some of this might be noob-issues. I am running Linux.
Back to top
View user's profile
cparrott



Joined: 02 May 2011
Posts: 146

PostPosted: Thu Mar 27, 2014 4:50 pm    Post subject: Reply with quote

Haakon,

I'm a bit perplexed by this message:

Quote:

/opt/pgi/linux86-64/14.3/bin/pgcc: not found


Any idea why pgcc is missing from this directory, but pgc++ is found? Strange.

libstdc++ is the standard GNU C++ library. Most systems have it installed in /usr/lib or /usr/lib64:

Quote:

cparrott ~ $ ls -l /usr/lib/libstdc++*
lrwxrwxrwx 1 root root 19 Sep 6 2012 /usr/lib/libstdc++.so.6 -> libstdc++.so.6.0.13
-rwxr-xr-x 1 root root 930192 Aug 24 2011 /usr/lib/libstdc++.so.6.0.13
cparrott ~ $


Hope this helps,

+chris
[/quote]
Back to top
View user's profile
Haakon



Joined: 18 Mar 2014
Posts: 10

PostPosted: Fri Mar 28, 2014 7:34 am    Post subject: It works! Reply with quote

Thank you a whole lot!

I think you hit the right spot here. For some reason the pgcc file was absent in the /opt/pgi/linux86-64/14.3/bin/ folder. However there was a file called "pgCC (Case Conflict)" in addition to the pgCC file, maybe this first one has been named uncorrect for some reason.

Now I am able to compile the HelloMEX function on Linux x86-64 using the following mexopts.sh file (I only quote the Linux 64 bit part of the file):

Quote:

#(...)
#---Line 96:
glnxa64)
#----------------------------------------------------------------------------
RPATH="-Wl,-rpath-link,$TMW_ROOT/bin/$Arch"
# StorageVersion: 1.0
# CkeyName: PGI C
# CkeyManufacturer: PGI
# CkeyLanguage: C
# CkeyVersion: 14.3
CC='/opt/pgi/linux86-64/14.3/bin/pgCC'
CFLAGS='-ansi -D_GNU_SOURCE'
CFLAGS="$CFLAGS "
CFLAGS="$CFLAGS -fpic -Mnoframe -mp"
CLIBS="$RPATH $MLIBS"
COPTIMFLAGS='-O3 ' #-DNDEBUG'
CDEBUGFLAGS='-g'
CLIBS="$CLIBS "
#
# C++keyName: PGI C++
# C++keyManufacturer: PGI
# C++keyLanguage: C++
# C++keyVersion: 14.3
CXX='/opt/pgi/linux86-64/14.3/bin/pgc++'
# CXXFLAGS='-ansi -D_GNU_SOURCE'
CXXFLAGS="$CXXFLAGS -Mnoframe -fPIC -largeArrayDims "

CXXLIBS="$RPATH $MLIBS -lm -L"/usr/lib/x86_64-linux-gnu" "
CXXOPTIMFLAGS='-O3 -DNDEBUG'
CXXDEBUGFLAGS='-g'
#
# FortrankeyName: gfortran
# FortrankeyManufacturer: GNU
# FortrankeyLanguage: Fortran
# FortrankeyVersion:
#
FC='gfortran'
FFLAGS=' -fbackslash'
FFLAGS="$FFLAGS -fpic -Mnoframe -pthread"
FLIBS="$RPATH $MLIBS -lm"
FOPTIMFLAGS='-O3'
FDEBUGFLAGS='-g'
#
LD='/opt/pgi/linux86-64/14.3/bin/pgCC' #"$COMPILER"
LDEXTENSION='.mexa64'
LDFLAGS="-shared -Wl,--version-script,$TMW_ROOT/extern/lib/$Arch/$MAPFILE -Wl,--no-undefined"
LDOPTIMFLAGS='-O3'
LDDEBUGFLAGS='-g'
#
POSTLINK_CMDS=':'
#----------------------------------------------------------------------------
;;
sol64)
#-----line 146
#(...)


Your question gave me a clue about pgcc beeing the correct linker to use also if the file compiled is C++. So I changed the mexopts.sh file specifying the linker:

Quote:

LD='/opt/pgi/linux86-64/14.3/bin/pgCC' #"$COMPILER"

Maybe this was the problem, that MEX tried to give the linking call to pgcpp?
Note also here that i specified pgCC to avoid the whole mystical pgcc thing.

I also found my libstdc++ file (Ubuntu 12) in the folder
Quote:
/usr/lib/x86_64-linux-gnu/


Compiling and running helloMEX now goes:
Code:

#include"mex.h"
#include"matrix.h"
#include <stdio.h>
#include <stdlib.h>

void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]){
//Error tests:
    if (nlhs!=0){
        mexErrMsgIdAndTxt("Toolbox:complexSinc:nlhs","no output is allowed");
    };
    if (nrhs!=0){
        mexErrMsgIdAndTxt("Toolbox:complexSinc:nrhs","no input matrix is allowed");
    };

  mexPrintf("MEX Hello world\n");

};


Quote:

>> mex helloMEX.cpp -v

**************************************************************************
Warning: Neither -compatibleArrayDims nor -largeArrayDims is selected.
Using -compatibleArrayDims. In the future, MATLAB will require
the use of -largeArrayDims and remove the -compatibleArrayDims
option. For more information, see:
http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html
**************************************************************************

-> mexopts.sh sourced from directory (DIR = .)
FILE = /home/haakon/Dropbox/NTNU/Masteroppgave/Propose_MAC_test/Sinc_test/mexopts.sh
----------------------------------------------------------------
-> MATLAB = /usr/local/MATLAB/R2013a
-> CC = /opt/pgi/linux86-64/14.3/bin/pgCC
-> CC flags:
CFLAGS = -ansi -D_GNU_SOURCE -fpic -Mnoframe -mp
CDEBUGFLAGS = -g
COPTIMFLAGS = -O3
CLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat
arguments = -DMX_COMPAT_32
-> CXX = /opt/pgi/linux86-64/14.3/bin/pgc++
-> CXX flags:
CXXFLAGS = -Mnoframe -fPIC -largeArrayDims
CXXDEBUGFLAGS = -g
CXXOPTIMFLAGS = -O3 -DNDEBUG
CXXLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -L/usr/lib/x86_64-linux-gnu
arguments = -DMX_COMPAT_32
-> FC = gfortran
-> FC flags:
FFLAGS = -fbackslash -fpic -Mnoframe -pthread
FDEBUGFLAGS = -g
FOPTIMFLAGS = -O3
FLIBS = -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm
arguments = -DMX_COMPAT_32
-> LD = /opt/pgi/linux86-64/14.3/bin/pgCC
-> Link flags:
LDFLAGS = -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
LDDEBUGFLAGS = -g
LDOPTIMFLAGS = -O3
LDEXTENSION = .mexa64
arguments =
-> LDCXX =
-> Link flags:
LDCXXFLAGS =
LDCXXDEBUGFLAGS =
LDCXXOPTIMFLAGS =
LDCXXEXTENSION =
arguments =
----------------------------------------------------------------

-> /opt/pgi/linux86-64/14.3/bin/pgc++ -c -I/usr/local/MATLAB/R2013a/extern/include -I/usr/local/MATLAB/R2013a/simulink/include -DMATLAB_MEX_FILE -Mnoframe -fPIC -largeArrayDims -DMX_COMPAT_32 -O3 -DNDEBUG "helloMEX.cpp"

-> /opt/pgi/linux86-64/14.3/bin/pgCC -O3 -shared -Wl,--version-script,/usr/local/MATLAB/R2013a/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "helloMEX.mexa64" helloMEX.o -Wl,-rpath-link,/usr/local/MATLAB/R2013a/bin/glnxa64 -L/usr/local/MATLAB/R2013a/bin/glnxa64 -lmx -lmex -lmat -lm -L/usr/lib/x86_64-linux-gnu

>> helloMEX
MEX Hello world
>>


Now the compiling works and I am exited about trying out OpenACC.

Btw. I get a lot of warnings like:

Quote:
"/opt/pgi/linux86-64/14.3/include/math.h", line 282: warning: allowing all
exceptions is incompatible with previous function "pow" (declared at
line 155 of "/usr/include/x86_64-linux-gnu/bits/mathcalls.h")
double pow(double,double);

when I compile the MEX version of sinc() that I mentioned in the first post. Is this something to worry about? Guess not...

Again thank you a whole lot for all help! I can post a final version of the working mexopts.sh file next week, after cleaning it up a bit.
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group