• 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 Design
  3. csh C script for automating the ocean simulation

Stats

  • Locked Locked
  • Replies 14
  • Subscribers 125
  • Views 15934
  • 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

csh C script for automating the ocean simulation

Aksh
Aksh over 4 years ago

Dear all,

I am trying to build a C script that sets the environment, invokes the ocean software and completes the simulation without any interventions required. (basically automating the whole simulation).

In the bigger picture, I want simulations to be invoked by MATLAB and I want the simulations to be performed in inputs varying iteratively (given by a Matlab algorithm).

The C script looks something like this:

csh

source /home/install/cshrc

ocean

load("test.ocn")

The problem is that the commands up to the line "ocean" work beautifully.

But I am not able to run the "load" command and is the reason I am not able to complete the simulation.


After some searching, I found that the "load" command can be placed in a .oceanrc file. But I am not sure it will work and also I am not able to find its directory nor have any idea where to place it. 

Can anyone suggest a method so that I can complete this script?

Any leads are highly appreciated.

Thank You

Aksh Chordia

  • Cancel
Parents
  • ShawnLogan
    ShawnLogan over 4 years ago

    Dear Aksh,

    Aksh said:
    After some searching, I found that the "load" command can be placed in a .oceanrc file. But I am not sure it will work and also I am not able to find its directory nor have any idea where to place it. 

    I believe the default location for your .oceanrc command is your $HOME directory. Its contents will be executed when ocean is invoked from the UNIX command line. In my case, I want the same variables set as when I launch a Cadence session. Hence, the contents of my ~/.oceanrc file is:

    "load("~/.cdsinit")"

    However, if your objective is to load the file "test.ocn", if the file "test.ocn" is in the same directory from which you are starting ocean, is there a reason you did not use the command:

    ocean -nograph < test.ocn > run_test.out

    This will load the file "test.ocn" and writes the output to a new file "run_test.out" and assumes no plotting is requried (-nograph option).

    An alternative command is included in the reference article:

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1Od0000000nVZuEAM&pageName=ArticleContent

    Does this help Aksh?

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • ShawnLogan
    ShawnLogan over 4 years ago

    Dear Aksh,

    Aksh said:
    After some searching, I found that the "load" command can be placed in a .oceanrc file. But I am not sure it will work and also I am not able to find its directory nor have any idea where to place it. 

    I believe the default location for your .oceanrc command is your $HOME directory. Its contents will be executed when ocean is invoked from the UNIX command line. In my case, I want the same variables set as when I launch a Cadence session. Hence, the contents of my ~/.oceanrc file is:

    "load("~/.cdsinit")"

    However, if your objective is to load the file "test.ocn", if the file "test.ocn" is in the same directory from which you are starting ocean, is there a reason you did not use the command:

    ocean -nograph < test.ocn > run_test.out

    This will load the file "test.ocn" and writes the output to a new file "run_test.out" and assumes no plotting is requried (-nograph option).

    An alternative command is included in the reference article:

    https://support.cadence.com/apex/ArticleAttachmentPortal?id=a1Od0000000nVZuEAM&pageName=ArticleContent

    Does this help Aksh?

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to ShawnLogan

    I personally tend to recommend using "ocean -restore test.ocn" rather than redirecting the input. This has the benefit of becoming an interactive session at the end - if you don't want that, you can always finish your OCEAN script with an exit() call.

    Regards,

    Andrew.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Andrew Beckett

    Dear Andrew,

    For my education, if I may, is your preference for using the "-restore" option based on the potential for an ocean buffer overflow? If you are busy, I fully understand and can bury my question!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to ShawnLogan

    Partly that, but mostly due to the fact that the behaviour with non-blocking elements can be different, and also that you don't get a return value per input line appearing in the output log. Using -restore is exactly like running virtuoso and then doing load() afterwards, whereas redirecting the input is just like typing everything in at the prompt.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Aksh
    Aksh over 4 years ago in reply to Andrew Beckett

    Will this work even in a csh script?

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Andrew Beckett

    Dear Andrew,

    Andrew Beckett said:
    Partly that, but mostly due to the fact that the behaviour with non-blocking elements can be different, and also that you don't get a return value per input line appearing in the output log

    Thank you for the added insight...and once again...your time and patience!

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Aksh
    Aksh over 4 years ago in reply to Andrew Beckett

    I tried by placing the command the command: in the csh script
    "ocean -restore test.ocn"

    But all it does again is open the ocean command line and not loading the test.ocn file.

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to Aksh

    Dear Aksh,

    Aksh said:
    Will this work even in a csh script?

    As long as you keep in mind that invoking "csh" opens a new shell...

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • ShawnLogan
    ShawnLogan over 4 years ago in reply to ShawnLogan

    Dear Aksh,

    Aksh said:
    But all it does again is open the ocean command line and not loading the test.ocn file.

    Did you try providing the full directory path to the file "test.ocn" as the argument to ocean? As I noted, csh will open a new shell.

    Shawn

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Andrew Beckett
    Andrew Beckett over 4 years ago in reply to Aksh

    Maybe you have wrapper scripts in your environment (and so you're not invoking directly the "ocean" from an IC installation; typing "which ocean" will tell you that), and those wrapper scripts are not passing the arguments through?

    The -restore option has been supported for as long as I can remember.

    Andrew

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
  • Aksh
    Aksh over 4 years ago in reply to ShawnLogan

    Thanks for your insight Shawn and Andrew.

    But I am a newbie to the world of cadence and csh scripting.

    My basic question is: what can I can to make the script work? (either basically make the script readable after the ocean command or by doing something else)

    • 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