You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

submit_mpi_containier.go 3.0 kB

3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. package main
  2. //
  3. //import "slurm/submitjob"
  4. //import "slurm"
  5. //import "os/user"
  6. //import "os"
  7. //import "strconv"
  8. //import "fmt"
  9. //import "os/exec"
  10. //import "path/filepath"
  11. //import "slurm/jobinfo"
  12. //import "time"
  13. //
  14. //
  15. //func fileExists(filename string) bool {
  16. // info, err := os.Stat(filename)
  17. // if os.IsNotExist(err) {
  18. // return false
  19. // }
  20. // return !info.IsDir()
  21. //}
  22. //func build_container(file_name,container_name string){
  23. //
  24. // cmd := exec.Command("sudo","/usr/local/bin/singularity", "build",container_name, file_name)
  25. // fmt.Print("Now build new container")
  26. // fmt.Printf("%s\n", cmd.String())
  27. // stdoutStderr, err := cmd.CombinedOutput()
  28. // if err != nil {
  29. // fmt.Printf("error in creating container %s \n", err)
  30. //
  31. // fmt.Printf("%s\n", stdoutStderr)
  32. //// return
  33. // }
  34. // fmt.Printf("%s\n", stdoutStderr)
  35. //}
  36. //
  37. //func main(){
  38. // job_desc := submit_job.Job_descriptor{}
  39. //
  40. // dir, _ := os.Getwd()
  41. // container := filepath.Join(dir, "mpi_container.img")
  42. // definition := filepath.Join(dir, "mpi_container.def")
  43. // if !fileExists(container){
  44. // build_container(definition,container)
  45. // }
  46. //
  47. // if !fileExists(container){
  48. // return
  49. // }
  50. // /* use Cmd to create our script */
  51. //
  52. // job_desc.Script = "#!/bin/bash\n export PATH=$PATH:/usr/local/bin\n hostname \n"
  53. // cmd := exec.Command( "/home0/opt/openmpi/bin/mpirun", "-mca btl_tcp_if_include eth1", "/usr/local/bin/singularity", "exec",container, "/opt/mpi_pingpong" )
  54. // job_desc.Script+= cmd.String()
  55. // fmt.Printf("cmd %s\n", job_desc.Script)
  56. // user, _:= user.Current()
  57. // userid , _ := strconv.Atoi(user.Uid)
  58. // job_desc.User_id= uint32(userid)
  59. // groupid , _ := strconv.Atoi(user.Gid)
  60. //
  61. // job_desc.Group_id= uint32(groupid)
  62. // job_desc.Name = "mpi_job"
  63. // job_desc.Partition="long"
  64. // job_desc.Time_limit = uint32(60)
  65. // job_desc.Min_nodes =uint32(2)
  66. // job_desc.Num_tasks = uint32(2)
  67. // job_desc.Std_out = ("./%j-out.txt")
  68. // job_desc.Std_err = ("./%j-err.txt")
  69. // job_desc.Work_dir = dir
  70. //
  71. // answer := submit_job.Submit_job(&job_desc)
  72. // if(answer.Error_code != 0) {
  73. // msg := slurm.GetErrorString(answer.Error_code)
  74. // fmt.Printf("Error: %s\n" ,msg)
  75. // return
  76. // }
  77. // fmt.Printf("Submitted Job %d\n", answer.Job_id)
  78. //
  79. //
  80. // job_list := job_info.Get_job(answer.Job_id)
  81. // if job_list.Error_code != 0 {
  82. // msg := slurm.GetErrorString(job_list.Error_code)
  83. // fmt.Printf("Error: %s\n" ,msg)
  84. // return
  85. //
  86. // }
  87. // job := job_list.Job_list[0]
  88. //
  89. // fmt.Printf("job %d is %s\n",answer.Job_id, job.Job_stateS)
  90. // state := job.Job_stateS
  91. // for state == "Pending" || state == "Running" {
  92. // time.Sleep(2 * time.Second)
  93. // job_list = job_info.Get_job(answer.Job_id)
  94. // if job_list.Error_code != 0 {
  95. // msg := slurm.GetErrorString(job_list.Error_code)
  96. // fmt.Printf("Error: %s\n" ,msg)
  97. // return
  98. //
  99. // }
  100. // job = job_list.Job_list[0]
  101. //
  102. // state = job.Job_stateS
  103. //
  104. // fmt.Printf("job %d is %s\n",answer.Job_id, job.Job_stateS)
  105. //
  106. //
  107. // }
  108. //
  109. // fmt.Printf("Total runtime Job %d: %s\n",job.Job_id, job_info.Get_job_runtime(job).String() )
  110. //
  111. //}

PCM is positioned as Software stack over Cloud, aiming to build the standards and ecology of heterogeneous cloud collaboration for JCC in a non intrusive and autonomous peer-to-peer manner.