EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: ADpython issues with openCV
From: "bryan.tester--- via Tech-talk" <[email protected]>
To: "[email protected]" <[email protected]>, "[email protected]" <[email protected]>
Cc: "[email protected]" <[email protected]>
Date: Mon, 1 Apr 2019 13:08:25 +0000
Hi,

The work I've been doing on adPython is located here: https://github.com/dls-controls/adPython/tree/killable_workers.

As Tom mentioned it incorporates the change to how the GIL is acquired and released, in addition to significantly changing how the actual processing is done; the processArray function is now called in a python multiprocessing worker process, and the main thread waits on the result in a queue (as such if the main thread no longer gets locked up if processArray fails for some way).

May be worth checking out this version of adPython and seeing if this helps things?

Thanks,

Bryan

________________________________
From: Cobb, Tom (DLSLtd,RAL,LSCI)
Sent: 01 April 2019 13:41:46
To: Malu, Sandeep Kumar (-,RAL,CLF)
Cc: [email protected]; J. Lewis Muir; Tester, Bryan (DLSLtd,RAL,LSCI)
Subject: RE: ADpython issues with openCV

Hi Sandeep,

This sounds very similar to an issue that Lewis (copied) had. processArray() would be called, but as soon as it called an openCV function then it hung there. For Lewis, changing the datatype from Int8 to UInt8 fixed things. Lewis also had some suggestions to do with using GIL Ensure and Release rather than SaveThread and RestoreThread in https://github.com/dls-controls/adPython/pull/9 which Bryan (also copied) is looking at merging, but we weren’t convinced those were contributing to the problem.

To continue debugging, I suggest you try an IOC with a simDetector, then change the datatype to UInt8 or UInt16 and see if that works. You can also try putting a debug statement in to print the array you are passed to check what datatype it is. You could also try throwing away the array processArray() is passed, making your own, and passing that to the OpenCV library to see if that works.

Thanks,
Tom


From: Malu, Sandeep Kumar (-,RAL,CLF) <[email protected]>
Sent: 01 April 2019 12:06
To: Cobb, Tom (DLSLtd,RAL,LSCI) <[email protected]>
Subject: RE: ADpython issues with openCV

Hi Tom

Thank you for the help.

On putting debug before add(), it display message once. On checking data type with PV- CAM:cam1:DataType_RBV , it reads UInt8.

Is this I need to confirm? Where exactly I need to mention UInt8 for NDArray?

Many Thanks
Sandeep Malu

Sent from Workspace ONE Boxer

On 01-Apr-2019 3:37 PM, "Cobb, Tom (DLSLtd,RAL,LSCI)" <[email protected]<mailto:[email protected]>> wrote:
Hi Sandeep,

A couple of things to try:


•         Could you put a logging debug statement at the beginning of the processArray() function before calling add() to see if it gets there

•         Can you tell me what DataType the NDArray is? I know we’ve had problems with Int8 and OpenCV before, but UInt8 seems to work

Thanks,
Tom


From: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> On Behalf Of sandeep-kumar.malu--- via Tech-talk
Sent: 26 March 2019 12:16
To: [email protected]<mailto:[email protected]>
Subject: ADpython issues with openCV

Hi
I created an IOC using the build instruction http://controls.diamond.ac.uk/downloads/support/adPython/0-1/documentation/doxygen/build_instructions_example.html.
On using numpy in adPythonTemplate.py<http://controls.diamond.ac.uk/downloads/support/adPython/0-1/documentation/doxygen/adPythonTemplate_8py.html> , it works but same didn’t work with openCV (“Array processed” debug message in console). Also I am not able to run any of the openCV functions inside adPythonTemplate.py<http://controls.diamond.ac.uk/downloads/support/adPython/0-1/documentation/doxygen/adPythonTemplate_8py.html>.   My st.cmd looks something like this

# Prosilica driver
###########################
prosilicaConfig("$(PREFIX)CAM", $(CAMID), 50, 0)
dbLoadRecords("ADBase.template","P=$(PREFIX),R=cam1:,PORT=$(PREFIX)CAM,ADDR=0,TIMEOUT=1")
dbLoadRecords("NDFile.template","P=$(PREFIX),R=cam1:,PORT=$(PREFIX)CAM,ADDR=0,TIMEOUT=1")
#adPythonPlugin
################################
adPythonPluginConfigure("$(PREFIX)CONTOUR", "/home/malu/adPython_sample/adPythonTemplate.py", "Template", 16, 0, "$(PREFIX)CAM", 0, 50, 0,0,2097152)
dbLoadRecords("NDPluginBase.template","P=$(PREFIX),R=Contour1:, PORT=$(PREFIX)CONTOUR,ADDR=0,TIMEOUT=1,NDARRAY_PORT=$(PREFIX)CAM,NDARRAY_ADDR=0")
dbLoadRecords("$(ADPYTHON)/db/adPythonPlugin.template","P=$(PREFIX),R=Contour1:, PORT=$(PREFIX)CONTOUR, TIMEOUT=1,NDARRAY_PORT=$(PREFIX)CAM")

I am using following configurations
Areadetector - R3-2
ADpython – 1-4
Python-opencv-headless – 3.4.0
Opencv(build from source) – 3.4.0
Ubuntu – 18

Look forward to hear from you at an early date.

Many thanks
Sandeep Malu

-- 
This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd. 
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom


Replies:
RE: ADpython issues with openCV sandeep-kumar.malu--- via Tech-talk
References:
ADpython issues with openCV sandeep-kumar.malu--- via Tech-talk
RE: ADpython issues with openCV tom.cobb--- via Tech-talk

Navigate by Date:
Prev: RE: ADpython issues with openCV tom.cobb--- via Tech-talk
Next: EPICS Controls Engineering Job Opportunity - Full-Time, Direct Role Alexander Gorinsky via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: ADpython issues with openCV tom.cobb--- via Tech-talk
Next: RE: ADpython issues with openCV sandeep-kumar.malu--- via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  <20192020  2021  2022  2023  2024 
ANJ, 03 Apr 2019 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·