Seagrid installation - mexrect.F error - out of memory

Discussion about analysis, visualization, and collaboration tools and techniques

Moderators: arango, robertson

Post Reply
Message
Author
User avatar
ngarg
Posts: 19
Joined: Fri Jul 12, 2013 5:46 pm
Location: NTU

Seagrid installation - mexrect.F error - out of memory

#1 Unread post by ngarg »

I am installing the seagrid package from the svn link on ROMS website instead of the one on USGS. When I use the script make_seagrid_mex, I get the following error:

Error using mexrect
Out of memory. Type HELP MEMORY for your options.

Error in test_mexrect (line 37)
z = mexrect ( z, np, n(1), n(2), n(3), n(4) );

Error in make_seagrid_mex (line 16)
test_mexrect;

With my little understanding, I believe it has something to do with mexrect routine in the fortran file. I am working on Matlab R13 linux 64 bit version. I managed to compile and test both mexsepeli and mexinside routines. I tried to change the size of Z, N and T array in the mexrect.F file but it does not solve it for me.

I was wondering if someone can help me solve this error.

Also, just for the information, when i use the Seagrid package from USGS website and compile mex files, it compiles them, but when i again pass mexrect command, i get segmentation fault.

User avatar
ngarg
Posts: 19
Joined: Fri Jul 12, 2013 5:46 pm
Location: NTU

Re: Seagrid installation - mexrect.F error - out of memory

#2 Unread post by ngarg »

After heaps of google search about mex files in Matlab 64 bit, I managed to get the mexrect file compiled and I was able to use the text_mexrect file on my linux 64 bit machine.

I modified the original mexrect.F in following way:

subroutine mexFunction ( nlhs, plhs, nrhs, prhs )
implicit none

#if defined (__alpha__) || defined (__x86_64__)
integer*8 plhs(*), prhs(*)
#else
integer plhs(*), prhs(*)
#endif

#if defined (__alpha__) || defined (__x86_64__)
integer*8 mxCreateDoubleMatrix, mxGetM, mxGetN, mxGetPi
integer*8 mxGetPr
#endif


#include "fintrf.h"
subroutine mexFunction ( nlhs, plhs, nrhs, prhs )
implicit none

#if defined (__alpha__) || defined (__x86_64__)
mwPointer plhs(*), prhs(*)
#else
integer plhs(*), prhs(*)
#endif

#if defined (__alpha__) || defined (__x86_64__)
mwPointer mxCreateDoubleMatrix, mxGetM, mxGetN, mxGetPi
mwPointer mxGetPr
#endif


Now, I am not sure why but it lets the compiler for Matlab 2013 compile the fortran file. I think its due to change in the Matlab Api or something.

Post Reply