## Unable to locate Mex-files when using seagrid package

Bug reports, work arounds and fixes

Moderators: arango, robertson

Post Reply
Message
Author
caozd999
Posts: 8
Joined: Tue Aug 19, 2014 4:35 pm
Location: UNIVERSITY OF FLORIDA

## Unable to locate Mex-files when using seagrid package

#1 Unread post by caozd999 »

Hi all,

I think I'm facing an old question relating to the seagrid package.
I just synchronized the Matlabscripts from https://www.myroms.org/svn/src/matlab, and added the folder(with subfolders) to matlab path.
But when I type 'seagrid' command in matlab2013b, there's always coming out the following message:
-----------------
>> seagrid

## Unable to locate Mex-files. Please install
## "mexrect", "mexsepeli", and "mexinside",
## then adjust your Matlab path accordingly.
---------------------------------------------
I found these three folders and added them in matlab path manually, but this didn't solve the problem.
Interesting is I could still go on generating and saving grid, and the grid can be converted to ROMS grid by seagrid2roms.m.
I looked up several posts on the same question, but none could help solve my problem. It's so annoying, does anyone know who to let it go? Thanks in advance.

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: ## Unable to locate Mex-files when using seagrid package

#2 Unread post by kate »

What you are getting without the mex files is a grid - but a grid that is not constrained to be orthogonal. ROMS was designed to be run with orthogonal grids in that non-orthogonal grids would require extra terms we aren't computing.

caozd999
Posts: 8
Joined: Tue Aug 19, 2014 4:35 pm
Location: UNIVERSITY OF FLORIDA

Re: ## Unable to locate Mex-files when using seagrid package

#3 Unread post by caozd999 »

kate wrote:What you are getting without the mex files is a grid - but a grid that is not constrained to be orthogonal. ROMS was designed to be run with orthogonal grids in that non-orthogonal grids would require extra terms we aren't computing.
Hi,Kate, thanks for letting me know this. I just stopped after generating the grid file, I didn't put it in any case.
What do you think the problem I have is? I have the full matlabscript folder that arango provides,and add all subfolders in matlab path.

Besides,I also meet with a "mexnc" problem when extracting bathymetry data from GSHHS, and this time it's fatal,
---------------------
>> extract_bath
Undefined function 'mexnc' for input arguments of type
'char'.

Error in c_bath (line 44)
[ncid,status]=mexnc('nccreate',Bname,'nc_write');

Error in extract_bath (line 65)
status=c_bath(Im,Jm,Oname);
----------------------------------

I notice somebody here suggested to download a third-party scripts, but I want to keep purity of ROMS matlabscript, so please,could anyone who succeeds using this matlabscript provide me any help? Thanks.

Ed

caozd999
Posts: 8
Joined: Tue Aug 19, 2014 4:35 pm
Location: UNIVERSITY OF FLORIDA

Re: ## Unable to locate Mex-files when using seagrid package

#4 Unread post by caozd999 »

"mexnc" problem is solved.

I followed the instruction from the ROMS WIKI https://www.myroms.org/wiki/index.php/M ... l_MEXNC.3F, and installed mexnc, then ran the extract scripts without problem.

caozd999
Posts: 8
Joined: Tue Aug 19, 2014 4:35 pm
Location: UNIVERSITY OF FLORIDA

Re: ## Unable to locate Mex-files when using seagrid package

#5 Unread post by caozd999 »

caozd999 wrote:Hi all,

I think I'm facing an old question relating to the seagrid package.
I just synchronized the Matlabscripts from https://www.myroms.org/svn/src/matlab, and added the folder(with subfolders) to matlab path.
But when I type 'seagrid' command in matlab2013b, there's always coming out the following message:
-----------------
>> seagrid

## Unable to locate Mex-files. Please install
## "mexrect", "mexsepeli", and "mexinside",
## then adjust your Matlab path accordingly.
---------------------------------------------
I found these three folders and added them in matlab path manually, but this didn't solve the problem.
Interesting is I could still go on generating and saving grid, and the grid can be converted to ROMS grid by seagrid2roms.m.
I looked up several posts on the same question, but none could help solve my problem. It's so annoying, does anyone know who to let it go? Thanks in advance.

I just realize that I need really "install" mexrect,mexsepeli and mexinside, rather than adding them to matlab path.
I tried to install mex by running "make_seagrid_mex.m" in mex folder (before that, I was guided to download and install winSDK), and the following errors came out
--------------------------------------------
Error: An options file for MEX was found, but the value for 'COMPILER'
was not set. This could mean that the value is not specified
within the options file, or it could mean that there is a
syntax error within the file.


C:\PROGRA~1\MATLAB\R2013A\BIN\MEX.PL: Error: Options file is invalid.

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

Error in make_seagrid_mex (line 15)
mex -f ./mexopts.sh -v mexrect.F
-----------------------------------------------------
I'm trying to fix it.

Anyone who is using SEAGRID, have you ever had the same problem with installation of mex?

caozd999
Posts: 8
Joined: Tue Aug 19, 2014 4:35 pm
Location: UNIVERSITY OF FLORIDA

Re: ## Unable to locate Mex-files when using seagrid package

#6 Unread post by caozd999 »

I think I need mention that I'm using 64bit WIN7 System and Matlab R2012b, and the seagrid code is the latest one.
I installed Microsoft.NET Framework 4 and SDK7.1.
I tried to install MEX by running "make_seagrid_mex" but met with the error as shown above.
The old seagrid folder contained a specific mex_<matlab version>_<system version> folder, but now the directory structure changes and this folder is replaced by a "mex" folder which is parallel to seagrid folder.

I hope it's a easy problem and only I get struggled here. But if someone can enlighten me a little bit, that would be great!

Ed

User avatar
kate
Posts: 4088
Joined: Wed Jul 02, 2003 5:29 pm
Location: CFOS/UAF, USA

Re: ## Unable to locate Mex-files when using seagrid package

#7 Unread post by kate »

Ah, I should have mentioned that the mex files are compiled Fortran codes. Do you have a Fortran compiler?

caozd999
Posts: 8
Joined: Tue Aug 19, 2014 4:35 pm
Location: UNIVERSITY OF FLORIDA

Re: ## Unable to locate Mex-files when using seagrid package

#8 Unread post by caozd999 »

kate wrote:Ah, I should have mentioned that the mex files are compiled Fortran codes. Do you have a Fortran compiler?
Hi kate. Yes I installed a trial Intel Visual Fortran Compiler XE15.0.
When I tried to install mex by the command
"mex -setup"
and then hit "n" (if I hit "y", only "Microsoft Software Development Kit (SDK) 7.1 " showed up), matlab showed me the following compiler in my system
----------------------
Select a compiler:
[1] Intel C++ 13.0 (with Microsoft Software Development Kit (SDK) linker)
[2] Intel C++ 13.0 (with Microsoft Visual C++ 2010 linker)
[3] Intel C++ 13.0 (with Microsoft Visual C++ 2012 linker)
[4] Intel C++ 12.0 (with Microsoft Software Development Kit (SDK) linker)
[5] Intel C++ 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[6] Intel C++ 12.0 (with Microsoft Visual C++ 2010 linker)
[7] Intel C++ 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[8] Intel Visual Fortran 13 (with Microsoft Software Development Kit (SDK) linker)
[9] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2010 linker)
[10] Intel Visual Fortran 13.0 (with Microsoft Visual C++ 2012 linker)
[11] Intel Visual Fortran 12 (with Microsoft Software Development Kit (SDK) linker)
[12] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 SP1 linker)
[13] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2008 Shell linker)
[14] Intel Visual Fortran 12.0 (with Microsoft Visual C++ 2010 linker)
[15] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 SP1 linker)
[16] Intel Visual Fortran 11.1 (with Microsoft Visual C++ 2008 Shell linker)
[17] Microsoft Software Development Kit (SDK) 7.1
[18] Microsoft Visual C++ 2005 SP1
[19] Microsoft Visual C++ 2008 SP1
[20] Microsoft Visual C++ 2010
[21] Microsoft Visual C++ 2012
---------------------------------------------------------------------
I tried each of them, but no one worked.
I think I might modify some configuration files (mexopts.sh ?) to help mex find the location of COMPILER,but don't know exactly what to do, won't stop trying though.
Do you know anyone who succeeds using SEAGRID in windows system? Or do you have any suggestions about my problem? I don't want to spend too much time on it since it should not be a problem.
Thanks.

detraceyb
Posts: 5
Joined: Mon May 28, 2012 2:56 pm
Location: Fisheries and Oceans Canada

Re: ## Unable to locate Mex-files when using seagrid package

#9 Unread post by detraceyb »

You need to be more specific about your problem. Did the mex files not compile or did they compile and not work?

Here is my guess. It is only a guess so hopefully someone out there can confirm. The fortran files used by seagrid might not compile properly for 64-bit versions of Matlab. My advice is to install a 32 bit version of Matlab just for seagrid. I have attached the 32bit windows mex files (Matlab 2010b 32bit).

This post discussed compiling for 64bit windows(and attached the mex files) but was for an older version of Matlab (2008b). I think the mex files did not work with more recent Matlab(2012a) versions because of mex interface changes. I have tried to compile myself, but without an Intel compiler it is much harder.

If you manage to compile for 64-bit Windows with a more recent Matlab version please attach your three mex files.

Edit: And remember to choose a C compiler for mexinside.c but a Fortran compiler for the other two. Make sure you choose the correct compilers for your Matlab version: http://www.mathworks.com/support/compil ... win64.html

Edit2: If you successfully compile, copy the three new mex files to the main seagrid folder.
Attachments
seagrid_mexw32.7z
(259.58 KiB) Downloaded 305 times

Post Reply