I should use <. to convert the float to an integer then it works. size =. <. 2 * 2 %~ 8192
On Mon, Nov 17, 2008 at 12:23 PM, Matthew Brand <[EMAIL PROTECTED]> wrote: > I am going to rewrite my program to use explicit loops to avoid these > really large arrays. I will write out the data to a separate file for > each of the rows of the larger array (this will be slow, but might > work). I still want to use mapped files to work with the row files > though, it will probably be much faster that (3!:0)~ (3!:1)? > > But does anyone know why the code below fails though? I want to > calculate the size of the mapped file inside a verb. The two pieces of > code below should both work but if I calculate "size" rather than just > assigning it the map_jmf_ verb does not work. > > I don't want to try the write code to read/write a large mapped file > in segments that fit into the physical memory because I don't think I > am good enough at J or understand enough about VAS and mapped files to > do that. > > size =. 8192 NB. just assign the size > bigfn =. jpath '~temp\big.jmf' > createjmf_jmf_ bigfn;size > map_jmf_ 'bigvar';bigfn > bigvar =. size # 'x' > unmap_jmf_ 'bigvar' > 0 > > size =. 2 * 2 %~ 8192 NB. just an example of calculating size > bigfn =. jpath '~temp\big.jmf' > createjmf_jmf_ bigfn;size > map_jmf_ 'bigvar';bigfn > |bad jmf header: assert > | 'bad jmf header' assert 0[free fh,mh,fad > > Thanks, > Matthew. > > PS thanks for the links Bjorn. > > On Mon, Nov 17, 2008 at 11:19 AM, Chris Burke <[EMAIL PROTECTED]> wrote: >> Matthew Brand wrote: >>> I originally asked this on general as part of a discussion about using >>> J64 on Linux under VMWare Fusion on a MacBook Pro, but it might be >>> better suited to the programming forum. >> >> Yes - questions on using J should go to programming; questions on >> installing J to general. >> >>> In Ubuntu, System Monitor->Resources->Memory I have got 2.8 GB of free >>> memory indicated. Should I be able to create a 2GB mapped file inside >>> the 64 bit VAS? I.e. should the code below work? Also, does the amount >>> of free memory matter anyway? Can mapped files be larger than the >>> amount of physical memory? I thought that with J64 I would be able to >>> (if I had enough disk space and time) create a mapped variable of size >>> 2^64 bytes, is that untrue? >> >> The jmf script in the current library supports both 32 and 64 bit. >> >> However, jmf maps the entire file and this requires that the file size >> be at least no greater than the available RAM. Since you need some RAM >> for the rest of your work, the maximum mapped file size is usually quite >> a bit less than available RAM. >> >> Since you could not create a mapped variable of size larger than RAM, >> then for larger mapped files, you would need to modify the map verb to >> map only a part of the file. >> >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm >> > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
