• 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. Run ipc command in multi-thread

Stats

  • Locked Locked
  • Replies 1
  • Subscribers 143
  • Views 5980
  • 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

Run ipc command in multi-thread

Martinsh
Martinsh over 2 years ago

How to run ipc command in multi-thread?

For example, 100 tasks will run on 5 threads.  At begining, the first 5 tasks are arranged on 5 threads. When one of the 5 tasks is completed, next task start automaticlly. There are always 5 tasks runing until no taskes left.

Regards,

Martin

  • Cancel
Parents
  • AurelBuche
    AurelBuche over 2 years ago

    Hi Martin,

    Not sure you could really call that multi-threading but here is a SKILL++ function that should do the job you're asking for :

    (inScheme
      (defun ipc_run_parallel (commands threads "lx")
        "Run COMMANDS in several parallel THREADS"
        (defun run_next_command nil
          (let ((command (pop commands)))
            (when command
              (ipcBeginProcess command ""
                (lambda (_pid _data)   nil)
                (lambda (_pid _data)   nil)
                ;; Start next thread when the current one is finished
                (lambda (_pid _status) (run_next_command))
                ))))
        ;; Start several threads in parallel
        (for i 1 threads (run_next_command))
        ))

    You can use it like :

    (ipc_run_parallel '("sleep 1" "sleep 2" "sleep 3" "sleep 4") 4)

    Cheers,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Reply
  • AurelBuche
    AurelBuche over 2 years ago

    Hi Martin,

    Not sure you could really call that multi-threading but here is a SKILL++ function that should do the job you're asking for :

    (inScheme
      (defun ipc_run_parallel (commands threads "lx")
        "Run COMMANDS in several parallel THREADS"
        (defun run_next_command nil
          (let ((command (pop commands)))
            (when command
              (ipcBeginProcess command ""
                (lambda (_pid _data)   nil)
                (lambda (_pid _data)   nil)
                ;; Start next thread when the current one is finished
                (lambda (_pid _status) (run_next_command))
                ))))
        ;; Start several threads in parallel
        (for i 1 threads (run_next_command))
        ))

    You can use it like :

    (ipc_run_parallel '("sleep 1" "sleep 2" "sleep 3" "sleep 4") 4)

    Cheers,

    Aurélien

    • Cancel
    • Vote Up 0 Vote Down
    • Cancel
Children
No Data

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