diff --git a/Distribute_computing/HPC_cluster/Taskhost.vb b/Distribute_computing/HPC_cluster/Taskhost.vb index 3f151a7..1cf817f 100644 --- a/Distribute_computing/HPC_cluster/Taskhost.vb +++ b/Distribute_computing/HPC_cluster/Taskhost.vb @@ -85,20 +85,37 @@ End Function ''' ''' ```bash -''' /parallel +''' /parallel --master <port> [--host <localhost, default=localhost> --socket <tempdir> --imageName <docker_imageName>] ''' ``` ''' Run task parallel ''' ''' - -Public Function Parallel() As Integer -Dim cli = GetParallelCommandLine(internal_pipelineMode:=True) +''' The host location of the master node, default is localhost, means parallel computing on one host node, different host ip means cluster computing. +''' +''' The tcp port of the master node that opened to current parallel slave node. +''' +''' A data location on shared storage of your cluster nodes if run parallel in cluster computing mode. +''' +''' The docker image name if your cluster application is deployed via docker. +''' +Public Function Parallel(master As String, Optional host As String = "localhost", Optional socket As String = "", Optional imagename As String = "") As Integer +Dim cli = GetParallelCommandLine(master:=master, host:=host, socket:=socket, imagename:=imagename, internal_pipelineMode:=True) Dim proc As IIORedirectAbstract = RunDotNetApp(cli) Return proc.Run() End Function -Public Function GetParallelCommandLine(Optional internal_pipelineMode As Boolean = True) As String +Public Function GetParallelCommandLine(master As String, Optional host As String = "localhost", Optional socket As String = "", Optional imagename As String = "", Optional internal_pipelineMode As Boolean = True) As String Dim CLI As New StringBuilder("/parallel") Call CLI.Append(" ") + Call CLI.Append("--master " & """" & master & """ ") + If Not host.StringEmpty Then + Call CLI.Append("--host " & """" & host & """ ") + End If + If Not socket.StringEmpty Then + Call CLI.Append("--socket " & """" & socket & """ ") + End If + If Not imagename.StringEmpty Then + Call CLI.Append("--imagename " & """" & imagename & """ ") + End If Call CLI.Append($"/@set --internal_pipeline={internal_pipelineMode.ToString.ToUpper()} ") diff --git a/Distribute_computing/Taskhost.d/Program.vb b/Distribute_computing/Taskhost.d/Program.vb index 3ec4deb..392c18c 100644 --- a/Distribute_computing/Taskhost.d/Program.vb +++ b/Distribute_computing/Taskhost.d/Program.vb @@ -42,6 +42,7 @@ #End Region Imports System.ComponentModel +Imports System.Net Imports Microsoft.VisualBasic.CommandLine Imports Microsoft.VisualBasic.CommandLine.Reflection @@ -72,9 +73,25 @@ Module Program ''' ''' - + [--host --socket --imageName ]")> + + + + Public Function Parallel(args As CommandLine) As Integer + Dim master As Integer = args <= "--master" + Dim host As String = args("--host") Or "localhost" + Dim socket As String = args <= "--socket" + Dim imageName As String = args <= "--imageName" End Function