-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
165 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/python | ||
|
||
# ------------------------------------------------------------------ | ||
# BSOF/I - Block structured factorization and inversion codes | ||
# for CPU+GPU platforms | ||
# Copyright (c) 2013, Sergiy Gogolenko | ||
# e-mail: sgogolenko/ucdavis.edu | ||
# ------------------------------------------------------------------ | ||
# Description: | ||
# Script for submitting job | ||
# ------------------------------------------------------------------ | ||
|
||
import os, sys | ||
os.environ['BSOFI_TOPDIR'] = r"/home/sergiy/project/BSOFI" | ||
|
||
sys.path.append(os.path.join(os.getenv('BSOFI_TOPDIR', '.'), 'python')) | ||
|
||
from bench import BSOFIPerformanceModel, BenchReportTable | ||
from platforms import user as platform | ||
from platforms import Job | ||
#Job, Platform, BashJobManager, PBSJobManager #zwolf as platform | ||
|
||
manager = platform.job_manager | ||
manager.submit(Job(" ".join(sys.argv[1:]))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/python | ||
|
||
# ------------------------------------------------------------------ | ||
# BSOF/I - Block structured factorization and inversion codes | ||
# for CPU+GPU platforms | ||
# Copyright (c) 2013, Sergiy Gogolenko | ||
# e-mail: sgogolenko/ucdavis.edu | ||
# ------------------------------------------------------------------ | ||
# Description: | ||
# Script for submitting job | ||
# ------------------------------------------------------------------ | ||
|
||
import os, sys | ||
os.environ['BSOFI_TOPDIR'] = r"@top_dir@" | ||
|
||
sys.path.append(os.path.join(os.getenv('BSOFI_TOPDIR', '.'), 'python')) | ||
|
||
from bench import BSOFIPerformanceModel, BenchReportTable | ||
from platforms import @system@ as platform | ||
from platforms import Job | ||
#Job, Platform, BashJobManager, PBSJobManager #zwolf as platform | ||
|
||
manager = platform.job_manager | ||
manager.submit(Job("ls -l")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/python | ||
|
||
# ------------------------------------------------------------------ | ||
# BSOF/I - Block structured factorization and inversion codes | ||
# for CPU+GPU platforms | ||
# Copyright (c) 2013, Sergiy Gogolenko | ||
# e-mail: [email protected] | ||
# ------------------------------------------------------------------ | ||
# Description: | ||
# Module for running jobs on different platforms. | ||
# ------------------------------------------------------------------ | ||
|
||
__all__ = ['job', 'platform'] | ||
|
||
from job import Job, PBSJobManager, BashJobManager | ||
from platform import Platform | ||
|
||
user = Platform(BashJobManager()) | ||
zwolf = Platform(BashJobManager()) | ||
dirac_fermi = Platform(PBSJobManager(r'config/jobs/dirac_fermi.sh.in')) | ||
dirac_tesla = Platform(PBSJobManager(r'config/jobs/dirac_tesla.sh.in')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/usr/bin/python | ||
|
||
# ------------------------------------------------------------------ | ||
# BSOF/I - Block structured factorization and inversion codes | ||
# for CPU+GPU platforms | ||
# Copyright (c) 2013, Sergiy Gogolenko | ||
# e-mail: [email protected] | ||
# ------------------------------------------------------------------ | ||
# Description: | ||
# Module for running jobs on different platforms. | ||
# ------------------------------------------------------------------ | ||
|
||
class Job(object): | ||
def __init__(self, cmd, **kw): | ||
super(Job, self).__init__() | ||
self.cmd = cmd | ||
self.attrs = kw | ||
pass | ||
|
||
def __getitem__(self, k): | ||
if k in self.attrs.keys(): | ||
return self.attrs[k] | ||
return super(Job, self).__getitem__(k) | ||
|
||
class JobManager(object): | ||
def __init__(self): | ||
super(JobManager, self).__init__() | ||
pass | ||
|
||
def submit(self, job): | ||
pass | ||
|
||
class PBSJobManager(JobManager): | ||
def __init__(self, job_template): | ||
super(PBSJobManager, self).__init__() | ||
self.job_template = job_template | ||
pass | ||
|
||
def submit(self, job): | ||
from popen2 import popen2 | ||
import time | ||
output, input = popen2('qsub -S /bin/bash') | ||
job_template_handle = open(job_template, "r") | ||
job_script = job_template_handle.read() | ||
job_template_handle.close() | ||
job_script = job_script.replace(r"@cmd@", job.cmd) | ||
input.write(job_string) | ||
input.close() | ||
print "Job is submited: [%s]" % output.read() | ||
time.sleep(0.1) | ||
pass | ||
|
||
class BashJobManager(JobManager): | ||
def __init__(self, cmd_submit = 'nohup'): | ||
super(BashJobManager, self).__init__() | ||
self.cmd_submit = cmd_submit | ||
pass | ||
|
||
def submit(self, job): | ||
from popen2 import popen2 | ||
import time | ||
output, input = popen2(r'%s %s &'% (self.cmd_submit, job.cmd)) | ||
#import os | ||
#os.system(r'%s %s &'% (self.cmd_submit, job.cmd)) | ||
print "Job is submited: [%s]" % output.read() | ||
time.sleep(0.1) | ||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/usr/bin/python | ||
|
||
# ------------------------------------------------------------------ | ||
# BSOF/I - Block structured factorization and inversion codes | ||
# for CPU+GPU platforms | ||
# Copyright (c) 2013, Sergiy Gogolenko | ||
# e-mail: [email protected] | ||
# ------------------------------------------------------------------ | ||
# Description: | ||
# Module for running jobs on different platforms. | ||
# ------------------------------------------------------------------ | ||
|
||
from job import Job, PBSJobManager, BashJobManager | ||
|
||
|
||
class Platform(object): | ||
def __init__(self, job_manager, **kw): | ||
super(Platform, self).__init__() | ||
self.job_manager = job_manager | ||
self.attrs = kw | ||
pass |