• Skip to main content
  • Skip to search
  • Skip to footer
Cadence Home
  • This search text may be transcribed, used, stored, or accessed by our third-party service providers per our Cookie Policy and Privacy Policy.

  1. Community Forums
  2. Custom IC SKILL
  3. asynchronous ocean coding

Stats

  • Locked Locked
  • Replies 8
  • Subscribers 143
  • Views 15106
  • Members are here 0
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

asynchronous ocean coding

ExcaIibur
ExcaIibur over 6 years ago

Below is the pseudo code that I want to do:

math() ;

ipcBeginProcess(watchdog()) ;

Basically what I want to achieve is to have the watchdog() function watch over math() function. From what I read, this should is exactly what the function ipcBeginProcess is designed to do. But somehow, I just can't make it work. I would like to know why my code doesn't work.
Below is my exact code:

bsh> ocean -restore script.ocn

The expected output is:

------------------I am asynchronous--------------

------------hello world-----------

------------hello world-----------

------------hello world-----------

------------hello world-----------

------------hello world-----------

However, I never saw '------------hello world-----------' in the output. Instead, all ipcBeginProcess did was bringing up a 2nd Welcome window, which I assume it means the child process was created successfully but looks like almost nothing happened after. BTW, the virtuoso version I am using is IC6.1.7.

  • Cancel
Parents
  • ExcaIibur
    ExcaIibur over 6 years ago

    I dragged and dropped 'script.ocn' and 'hello_world.ocn' here, but I can't tell if they have been successfully uploaded. If they are still not, please let me know.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to ExcaIibur

    No, they've not been attached. I think I'd need to see the code to understand what you're trying to do. Not really sure what you mean by having this watchdog function watch over the math() function - they are in separate processes, so not sure what would be watching what.

    Try using Insert->Image/Video/File and then loading the file from the computer. it should show up in the post before you post so it should be fairly obvious that it worked. Drag and drop is mainly for images, not for other files.

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ExcaIibur
    ExcaIibur over 6 years ago in reply to Andrew Beckett

    Unfortunately the uploading system seem to be unfriendly to me

    Let me try to do it the stupid way

    script.ocn:

    let( ( cid)
    cid=ipcBeginProcess("ocean -replay ./hello_world.ocn")
    printf("------------------I am asynchronous--------------\n") ;
    ); end let

    hello_world.ocn:

    procedure(hello_world()
    let( (i)
    i=0 ;
    while( i<5
    printf("------------hello world-----------\n")
    i=i+1 ;
    );end while
    );end let
    );end procedure
    hello_world()

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ExcaIibur
    ExcaIibur over 6 years ago in reply to ExcaIibur

    Somehow I can't type in sleep(2) after i=i+1;

    Whenever I tried to do so, there is a message "An error occurred. Please try again or contact your administrator". And what is strange is that I can type in sleep(2) here.

    Please add that to the code.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to ExcaIibur

    Not entirely sure the point of this, because the printed information won't appear anywhere in the background process. So I modified script.ocn to have a data handler to print that. I also unset CDS_MPS_SESSION - in general when starting one virtuoso (or ocean) from another, you should do this as otherwise they can end up interfering with each other (MPS is the mechanism via which remote procedure calls work in Virtuoso, and otherwise they share the same session and you end up with a clash of services from the two virtuosos that are running).

    https://community.cadence.com/cfs-file/__key/communityserver-discussions-components-files/48/script.ocn

    I also altered hello_world.ocn to flush the output buffer, and also used ipcSleep() instead of sleep. I think your problem was probably caused by the MPS (not sure) clash, but in general ipcSleep is preferable to sleep as it allows data handlers to be executed (not that you have any in the child process, but just in case).

    https://community.cadence.com/cfs-file/__key/communityserver-discussions-components-files/48/hello_5F00_world.ocn

    Not sure why you had a problem with the file upload - it appears to have worked fine for me.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ExcaIibur
    ExcaIibur over 6 years ago in reply to Andrew Beckett

    HI Andrew,

    Did you observe "------------------I am asynchronous--------------" in the output? I was expecting it to see it in the output, but it did not. 

    I think my question is:

    1. Was printf("------------------I am asynchronous--------------\n") ; actually executed before hello_world.ocn finished?

    2. Was there a limitation that whatever code after ipcBeginProcess has the limitation that it cannot output to stdout?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to ExcaIibur

    Yes, it appeared immediately after the ipcBeginProcess, and then I see all the output log info from the child ocean/virtuoso process, and then finally I see all the hello world statements (which appeared at 2 second intervals).

    The ipcBeginProcess returns immediately (it doesn't wait for the child to complete - which doesn't actually complete in this case anyway as there's no exit in the hello_world.ocn), and then the code continues as normal after it returns. There's no limitation here at all - not sure how you came to that conclusion.

    Regards,

    Andrew.

    (I tried pasting in the output but the forum server probably needs restarting as it wouldn't work - probably your attempt to upload the files is related - we're awaiting changing to a new more reliable server)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • Andrew Beckett
    Andrew Beckett over 6 years ago in reply to ExcaIibur

    Yes, it appeared immediately after the ipcBeginProcess, and then I see all the output log info from the child ocean/virtuoso process, and then finally I see all the hello world statements (which appeared at 2 second intervals).

    The ipcBeginProcess returns immediately (it doesn't wait for the child to complete - which doesn't actually complete in this case anyway as there's no exit in the hello_world.ocn), and then the code continues as normal after it returns. There's no limitation here at all - not sure how you came to that conclusion.

    Regards,

    Andrew.

    (I tried pasting in the output but the forum server probably needs restarting as it wouldn't work - probably your attempt to upload the files is related - we're awaiting changing to a new more reliable server)

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • ExcaIibur
    ExcaIibur over 6 years ago in reply to Andrew Beckett

    Thanks for the confirmation. After examining stdout again, I found "------------------I am asynchronous--------------", somewhere buried in the pages of stdout from the flow enabler.

    Currently, it seems this ipcBeginProcess is working as I expected and I can continue.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel

Community Guidelines

The Cadence Design Communities support Cadence users and technologists interacting to exchange ideas, news, technical information, and best practices to solve problems and get the most from Cadence technology. The community is open to everyone, and to provide the most value, we require participants to follow our Community Guidelines that facilitate a quality exchange of ideas and information. By accessing, contributing, using or downloading any materials from the site, you agree to be bound by the full Community Guidelines.

© 2025 Cadence Design Systems, Inc. All Rights Reserved.

  • Terms of Use
  • Privacy
  • Cookie Policy
  • US Trademarks
  • Do Not Sell or Share My Personal Information