⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 .pawsrc

📁 强大的并行科学计算软件包
💻 PAWSRC
字号:
# Default variables
#

# Set various flags
# 
set DEBUG      0	;# Debug levels 0 (none) 5 (comprehensive)
#set EXEC $env(PAWS_EXEC) ;# How to exec progs - mpi, mpich, or bsub
set EXEC local
set HOST $env(HOST)
if {$HOST == "bluemountain"} {
  set HOST $env(HOSTNAME)
}
set qname "shared" ;# Use shared queue as default to bsub


# Connect two tasks
#
proc connectPawsTasks {task1 task2} {
    # Do both tasks exist
    while {
      ( ([paws check ready $task1] != "READY") ||
        ([paws check ready $task2] != "READY") )
    } {
      puts "Waiting for $task1 and $task2 to register with controller ..."
      exec sleep 2
    }
    # Connect programs within PAWS
    paws connect task $task1 $task2
}


# Connect two datas
#
proc connectPawsData {data1 data2 {convert_options "NULL"} } {
    # Do both datas exist
    if {$data1 != "NULL" && $data2 != "NULL"} {
        # Connect data within PAWS
        paws connect data $data1 $data2 $convert_options 

        # Make sure the data is connected
        while {
          ([paws check connect data $data1 $data2] != "CONNECTED")
        } {
          puts "Waiting for data connections between $data1 and $data2 ..."
          exec sleep 2
        }
    }
}


# Run the application on the host machine with given number of processors
# If the number of processors is 0, look up the registered default
#
proc runPawsTask {application host {numproc 0}} {
    global DEBUG
    global EXEC
    global qname

    # Make the task and get its unique id
    # If NULL is returned then the program or host are not registered
    #
    set taskid [paws create taskid $application $host]

    if {$taskid != "NULL"} {

	# Get the executable path and other communication information
        set exec_path  [paws get path $application $host]
	set host_nodes [paws get hostnodes $host]
	set host_type  [paws get hosttype $host]
	set con_handle [paws get handle]
	set con_port   [paws get port]$taskid
	set cur_dir    [exec pwd]

	# Set the number of processors to run on
	if {$numproc == 0} {
	    set numproc [paws get defnodes $application $host]
	}
	if {$numproc > $host_nodes} {
	    puts "... $host allows a maximum of $host_nodes nodes"
	    set numproc $host_nodes
	}
	if {$numproc > 8} {
	    set qname "dedicated -W 5"
	}

	set paws_arg "-v -paws $con_handle $con_port -Dpaws $DEBUG"
	set xterm_arg "-sl 3000 -g 120x20 -title $host:$exec_path"

        puts "... Running $taskid on $host\($host_type\) $numproc node(s)"
	
        if {$EXEC == "local"} {
	puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir $exec_path $paws_arg\n"
        exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir $exec_path $paws_arg &
	}

        if {$EXEC == "aclmpl"} {
	puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir $exec_path --commlib aclmpl --processes $numproc $paws_arg\n"
        exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir $exec_path --commlib aclmpl --processes $numproc $paws_arg &
	}

	if {$EXEC == "bsub"} {
	puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir bsub -q $qname -n $numproc  -Is mpirun -np $numproc $exec_path $paws_arg\n"
       exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir bsub -q $qname -n $numproc -Is mpirun -np $numproc $exec_path $paws_arg &
	}

	if {$EXEC == "mpi"} {
	puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -p $host $numproc $exec_path $paws_arg\n"

        exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -p $host $numproc $exec_path $paws_arg &
	}

        if {$EXEC == "mpich"} {
        puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -np $numproc $exec_path $paws_arg\n"

        exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -np $numproc $exec_path $paws_arg &
        }

    } else {
	puts "... Program $application on host $host was not found."
    }
    return $taskid
}


# Run the POOMA application on the host machine with given # of procs.
proc runPOOMATask {application host {numproc 0} {commlib mpi} {viz 0}} {
    global DEBUG
    global EXEC
    global qname

    # Make the task and get its unique id
    # If NULL is returned then the program or host are not registered
    #
    set taskid [paws create taskid $application $host]

    if {$taskid != "NULL"} {

	# Get the executable path and other communication information
        set exec_path  [paws get path $application $host]
	set host_nodes [paws get hostnodes $host]
	set host_type  [paws get hosttype $host]
	set con_handle [paws get handle]
	set con_port   [paws get port]$taskid
	set cur_dir    [exec pwd]

	# Set the number of processors to run on
	if {$numproc == 0} {
	    set numproc [paws get defnodes $application $host]
	}
	if {$numproc > $host_nodes} {
	    puts "... $host allows a maximum of $host_nodes nodes"
	    set numproc $host_nodes
	}
	if {$numproc > 8} {
	    set qname "dedicated -W 5"
	}

        # Set the argument for what communication method to use
        set commarg ""
        if {$numproc > 1} {
            if {$commlib == "mpi"} {
                set commarg "--commlib mpi"
            }
            if {$commlib == "aclmpl"} {
                set commarg "--commlib aclmpl --processes $numproc"
            }
        }

        # Set the argument for whether to use visualization
        set vizarg ""
        if {$viz > 0} {
            set vizarg "--connect aclvis"
        }

	set paws_arg "$commarg $vizarg -nx -paws $con_handle $con_port -Dpaws $DEBUG"
	set xterm_arg "-sl 3000 -g 120x20 -title $host:$exec_path"

        puts "... Running $taskid on $host\($host_type\) $numproc node(s)"

###
### bsub version
###
	if {$EXEC == "bsub"} {
	puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir bsub -q $qname -n $numproc -Is mpirun -np $numproc $exec_path $paws_arg\n"
	exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir bsub -q $qname -n $numproc -Is mpirun -np $numproc $exec_path $paws_arg &
	}

###
### non-bsub version
###
	if {$EXEC == "mpi"} {
	puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -p $host $numproc $exec_path $paws_arg\n"
        exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -p $host $numproc $exec_path $paws_arg &
	}

        if {$EXEC == "mpich"} {
        puts "\nxterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -np $numproc $exec_path $paws_arg\n"
        exec xterm -sl 3000 -g 120x20 -title $host:$exec_path -e keepit $cur_dir mpirun -np $numproc $exec_path $paws_arg &
        }

    } else {
	puts "... Program $application on host $host was not found."
    }
    return $taskid
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -