Results 1 to 3 of 3

Thread: Queuing work for processor

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2014
    Posts
    1

    Queuing work for processor

    I have these problem which I think VB.NET might be able to solve but I'm not sure how to go about it.

    I am doing a large number of simulation runs and each run calls an executable separately with parameters. So I might have something like:

    Model.exe run1.txt
    Model.exe run2.txt
    .
    .
    Model.exe run10000.txt

    I have a server with 60 cores so I need someway to kick off 60 runs and will start another run each time a core is freed up.

    Does anyone roughly know how this can be done?

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,481

    Re: Queuing work for processor

    try this:

    Code:
    Public Class Form1
    
        Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
            Dim listOfRuns As New List(Of String)
            listOfRuns.Add("Model.exe run1.txt")
            listOfRuns.Add("Model.exe run2.txt")
            For Each run In listOfRuns
                Threading.ThreadPool.QueueUserWorkItem(AddressOf ProcessItem, run)
            Next
    
        End Sub
    
        Private Sub ProcessItem(ByVal item As Object)
            'this is where you run your executables
        End Sub
    
    End Class
    there's more information on the ThreadPool here:

    http://www.dotnetperls.com/threadpool-vbnet

  3. #3
    Sinecure devotee
    Join Date
    Aug 2013
    Location
    Southern Tier NY
    Posts
    6,582

    Re: Queuing work for processor

    Hopefully not a lot of disk reads and writes involved in the simulations.
    If you have 60 parallel processes logging to 60 different files at the same time, the file access may be a bottleneck and file access will sub optimal in the future as probably none of the files will be contiguous on the disk, but have blocks interleaved with all the other files being written at the time.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width