Skip to main content

HPC Task python library.

Project description

HPC Task

Python package for easy HPC task management based on paramiko.

Installation

pip install -U hpc_task

Requirements

  • paramiko
  • ase

Usage

import ase
from hpc_task.hpc import HPCTask
from hpc_task.hpc_calculator.vasp import Vasp as hpc_Vasp  # 必须导入hpc_Vasp 而非原生的 ase 的 Vasp

target_host = {
    'hostname': "TARGET HOST IP",
    'port': 22, 
    'username': "YOUR_USERNAME",
    'password': "YOUR_PASSWD", 
}

workdir = 'test_vasp_calc'
hpc = HPCTask(workdir=workdir)
hpc.scriptdir = '/data/bin/remote.job'  # 提交作业的脚本
hpc.connect(target_host)
# 启动队列,得到 jobid
hpc.prerun()
jobid = hpc.jobid
hpc.close()  # 此时可以关闭 ssh 通道

# 在运行时候再重新构造和连接 hpc
hpc = HPCTask(jobid=jobid)  # workdir 会根据 jobid 提取得到
hpc.connect(target_host)
hpc.get_workdir()
# 结构、计算参数设置
atoms = ase.Atoms('N2', positions=[(0., 0., 0.), (1.4, 0., 0.)],
                  cell=[10, 10, 10], pbc=True)
# calc 设置
calc = hpc_Vasp(  
            xc='pbe',
            directory=hpc.workdir,  # 必须设置, 会新建文件夹,并进入文件夹执行命令
            command='mpirun -np 8 vasp544_std',  # 必须设置,或者提供了 ASE vasp 的相关设置
            hpctask=hpc,  # 这个非常关键,必须提供
            gamma=True,
            encut=400,
            lwave=False,
            lcharg=False,
            )
# 计算
atoms.calc = calc
e = atoms.get_potential_energy()
print(f"Energy of N2 is {e} eV.")
# finish job,结束节点任务
hpc.postrun()
# 关闭通道
hpc.close()

TODO

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

hpc_task-0.1.3.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hpc_task-0.1.3-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file hpc_task-0.1.3.tar.gz.

File metadata

  • Download URL: hpc_task-0.1.3.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for hpc_task-0.1.3.tar.gz
Algorithm Hash digest
SHA256 eda5cb5a28ab549ce24cd77bd9853039abef1cc02ab6978f925449131626d3db
MD5 28373d325cbf803c6b2f2817b72b11a7
BLAKE2b-256 fac289832ccc561f9fe70fe91a2180860fd4dba693206dad665be7f21c077b1e

See more details on using hashes here.

File details

Details for the file hpc_task-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: hpc_task-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for hpc_task-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 6f7d79207f0b6da293c3ec3e601dfa2d9c1cb378d7a8b23f7af1fa253b07e7df
MD5 49c3a5c5317ef724161d7e78f8e1dd81
BLAKE2b-256 ebcdc95290689260b3bfe7eb476171bb146068163c7db5b8c733ebac0b8d20b9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page