cluster.sh 3.2 KB
Newer Older
T
tangwei 已提交
1
#!/bin/bash
T
tangwei 已提交
2 3 4 5 6 7 8 9 10 11 12 13 14 15
# Copyright (c) 2020 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

T
tangwei 已提交
16 17 18

###################################################
# Usage: submit.sh
T
tangwei 已提交
19
# Description: run mpi submit client implement
T
tangwei 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
###################################################

# ---------------------------------------------------------------------------- #
#                            variable define                                   #
# ---------------------------------------------------------------------------- #

#-----------------------------------------------------------------------------------------------------------------
#fun : package
#param : N/A
#return : 0 -- success; not 0 -- failure
#-----------------------------------------------------------------------------------------------------------------
function package_hook() {
  g_run_stage="package"
  package
}

#-----------------------------------------------------------------------------------------------------------------
#fun : before hook submit to cluster
#param : N/A
#return : 0 -- success; not 0 -- failure
#-----------------------------------------------------------------------------------------------------------------
function _before_submit() {
  echo "before_submit"
  before_submit_hook
}

#-----------------------------------------------------------------------------------------------------------------
#fun : after hook submit to cluster
#param : N/A
#return : 0 -- success; not 0 -- failure
#-----------------------------------------------------------------------------------------------------------------
function _after_submit() {
  echo "after_submit"
  after_submit_hook
}

#-----------------------------------------------------------------------------------------------------------------
#fun : submit to cluster
#param : N/A
#return : 0 -- success; not 0 -- failure
#-----------------------------------------------------------------------------------------------------------------
function _submit() {
  g_run_stage="submit"

T
bug fix  
tangwei12 已提交
64 65 66 67 68
  cd ${engine_temp_path}

  paddlecloud job --ak ${engine_submit_ak} --sk ${engine_submit_sk} train --cluster-name ${engine_submit_cluster} \
    --job-version ${engine_submit_version} \
    --mpi-priority ${engine_submit_priority} \
T
tangwei 已提交
69
    --mpi-wall-time 300:59:00 \
T
bug fix  
tangwei12 已提交
70
    --mpi-nodes ${engine_submit_nodes} --is-standalone 0 \
T
tangwei 已提交
71
    --mpi-memory 110Gi \
T
bug fix  
tangwei12 已提交
72 73 74 75
    --job-name ${engine_submit_jobname} \
    --start-cmd "${g_run_cmd}" \
    --group-name ${engine_submit_group} \
    --job-conf ${engine_submit_config} \
T
tangwei 已提交
76 77
    --files ${g_submitfiles} \
    --json
T
bug fix  
tangwei12 已提交
78 79

  cd -
T
tangwei 已提交
80 81 82 83 84 85 86 87 88
}

function submit_hook() {
  _before_submit
  _submit
  _after_submit
}

function main() {
T
bug fix  
tangwei12 已提交
89 90
  source ${engine_submit_scrpit}

T
tangwei 已提交
91 92 93 94
  package_hook
  submit_hook
}

T
bug fix  
tangwei12 已提交
95
main