comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: IDL_IDLBridge and SHMMAP - shared memory not found
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: IDL_IDLBridge and SHMMAP - shared memory not found [message #79539] Tue, 06 March 2012 06:37 Go to next message
Jim  Pendleton is currently offline  Jim Pendleton
Messages: 165
Registered: November 2011
Senior Member
On Tuesday, March 6, 2012 2:41:28 AM UTC-7, Percy Pugwash wrote:
> I'm trying to do some processing in "in the background" using the IDL_IDLBridge object. I want to avoid making unnecessary copies of all the data, and also gain the speed benefits mentioned here: https://groups.google.com/d/topic/comp.lang.idl-pvwave/fRXH- lDbdKc/discussion
>
> So, I am using the shmmap and shmvar functionality to share the data.
>
> shmmap,size=size(image),get_name=shmname
> var = shmvar(shmname)
> var[0,0] = image
>
> The IDL_IDLBridge object seems to be working OK
>
> bridge->setvar,'nlevels',nlevels
> bridge->setvar,'shmname',shmname
> bridge->execute,'makePyramid,nlevels,shmname=shmname'
>
> The problem seems to be that the shmmapped memory does not seem to be visible from the child IDL process. When I get run the execute method of bridge as above, I get the following error:
>
> IDL_IDLBRIDGE Error: SHMVAR: Shared Memory Segment not found: IDL_SHM_700_0
>
> However, I can see using help,/shared_memory (while the IDE is paused in debug mode) that the sought-after shared memory segment does indeed exist.
>
> IDL> help,/shared_memory
> IDL_SHM_700_0 BYTE = <WindowsAnonymous(IDL_SHM_700_0), Offset(0), Refcnt(0)> Array[5120, 5696]
>
> Why can't the child process see the shared memory?
>
> I am using 64-bit IDL on Windows XP.
>
> P

One key here, depending on your platform and the type of shared memory you're creating, is the not-so-obvious os_handle keyword to shmmap. Once you find a pattern of os_handle and segmentname parameters that works for you, you tend not to have to think about it again.

In IDL process 1:

pro shared1
shmmap, 'firstsegment', dimension = 5, template = {widget_draw}, $
os_handle = 'percy'
v = shmvar('firstsegment')
v[0].modifiers = 1
help,/str,v[0]
end

In IDL process 2:

pro shared2
shmmap, template = {widget_draw}, get_name = gn, $
os_handle = 'percy', dimension = 5
pv = ptr_new(shmvar(gn))
help,/str,(*pv)[0]
print, gn
end

Jim P.
Re: IDL_IDLBridge and SHMMAP - shared memory not found [message #79577 is a reply to message #79539] Mon, 12 March 2012 10:22 Go to previous message
Percy Pugwash is currently offline  Percy Pugwash
Messages: 12
Registered: January 2012
Junior Member
On Tuesday, 6 March 2012 14:37:41 UTC, jimmylee...@gmail.com wrote:
> On Tuesday, March 6, 2012 2:41:28 AM UTC-7, Percy Pugwash wrote:
>> I'm trying to do some processing in "in the background" using the IDL_IDLBridge object. I want to avoid making unnecessary copies of all the data, and also gain the speed benefits mentioned here: https://groups.google.com/d/topic/comp.lang.idl-pvwave/fRXH- lDbdKc/discussion
>>
>> So, I am using the shmmap and shmvar functionality to share the data.
>>
>> shmmap,size=size(image),get_name=shmname
>> var = shmvar(shmname)
>> var[0,0] = image
>>
>> The IDL_IDLBridge object seems to be working OK
>>
>> bridge->setvar,'nlevels',nlevels
>> bridge->setvar,'shmname',shmname
>> bridge->execute,'makePyramid,nlevels,shmname=shmname'
>>
>> The problem seems to be that the shmmapped memory does not seem to be visible from the child IDL process. When I get run the execute method of bridge as above, I get the following error:
>>
>> IDL_IDLBRIDGE Error: SHMVAR: Shared Memory Segment not found: IDL_SHM_700_0
>>
>> However, I can see using help,/shared_memory (while the IDE is paused in debug mode) that the sought-after shared memory segment does indeed exist.
>>
>> IDL> help,/shared_memory
>> IDL_SHM_700_0 BYTE = <WindowsAnonymous(IDL_SHM_700_0), Offset(0), Refcnt(0)> Array[5120, 5696]
>>
>> Why can't the child process see the shared memory?
>>
>> I am using 64-bit IDL on Windows XP.
>>
>> P
>
> One key here, depending on your platform and the type of shared memory you're creating, is the not-so-obvious os_handle keyword to shmmap. Once you find a pattern of os_handle and segmentname parameters that works for you, you tend not to have to think about it again.
>
> In IDL process 1:
>
> pro shared1
> shmmap, 'firstsegment', dimension = 5, template = {widget_draw}, $
> os_handle = 'percy'
> v = shmvar('firstsegment')
> v[0].modifiers = 1
> help,/str,v[0]
> end
>
> In IDL process 2:
>
> pro shared2
> shmmap, template = {widget_draw}, get_name = gn, $
> os_handle = 'percy', dimension = 5
> pv = ptr_new(shmvar(gn))
> help,/str,(*pv)[0]
> print, gn
> end
>
> Jim P.

Thanks Jim. Turned out my problem was much more fundamental however; I had thought that memory mapped with SHMMAP would be visible to child processes using only SHMVAR. When I realised I need to use SHMMAP in both the parent and child processes (thanks to your example), it worked a charm.

P
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL routines dependencies map maker
Next Topic: Array Tiling - The IDL Way

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 15:15:49 PDT 2025

Total time taken to generate the page: 0.00689 seconds