在HPC的节点上使用jupyter notebook
投递任务,注意资源设置
#!/bin/bash
#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --cpus-per-task=1
#SBATCH --mem=4G
#SBATCH --time 00:05:00
#SBATCH --job-name jupyter-notebook
#SBATCH --output jupyter-notebook-%J.log # get tunneling info
XDG_RUNTIME_DIR=""
node=$(hostname -s)
user=$(whoami)
cluster="tigercpu"
port=8889 # print tunneling instructions jupyter-log
echo -e "
Command to create ssh tunnel:
ssh -N -f -L ${port}:${node}:${port} ${user}@${cluster}.princeton.edu Use a Browser on your local machine to go to:
localhost:${port} (prefix w/ https:// if using password)
" # load modules or conda environments here
module load anaconda3 # Run Jupyter
jupyter-lab --no-browser --port=${port} --ip=${node}
在本地电脑映射端口
ssh -N -f -L 8889:tiger-h26c2n22:8889 <yourusername>@tigercpu.princeton.edu
在浏览器中打开即可使用
有些分析比较耗费资源,结果文件也是上G的,这时再把结果copy到本地处理就也不合适了。
那就需要在HPC上使用python或R来处理数据,之前使用jupyter一直不成功,想把vim变成R的IDE,发现更难,各种配置很复杂,使用起来门槛也比较高。
今天碰巧搜素了PBS上运行jupyter,还真的找到了正确的配置方法,核心就是用ssh做了一个映射,用本地的端口来监听远程的端口,只要在一个局域网内,就能通过地址和主机名来连接,通过ssh协议来通讯
-N Do not execute a remote command. This is useful for just forwarding ports.
-f Requests ssh to go to background just before command execution. This is useful if ssh is going to ask for passwords or passphrases, but the user wants it in
the background. This implies -n. The recommended way to start X11 programs at a remote site is with something like ssh -f host xterm. If the ExitOnForwardFailure configuration option is set to “yes”, then a client started with -f will wait for all remote port forwards to be successfully
established before placing itself in the background.
-L local_socket:remote_socket
Specifies that connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on
the remote side. This works by allocating a socket to listen to either a TCP port on the local side, optionally bound to the specified bind_address, or to a
Unix socket. Whenever a connection is made to the local port or socket, the connection is forwarded over the secure channel, and a connection is made to
either host port hostport, or the Unix socket remote_socket, from the remote machine. Port forwardings can also be specified in the configuration file. Only the superuser can forward privileged ports. IPv6 addresses can be specified by
enclosing the address in square brackets. By default, the local port is bound in accordance with the GatewayPorts setting. However, an explicit bind_address may be used to bind the connection to a
specific address. The bind_address of “localhost” indicates that the listening port be bound for local use only, while an empty address or ‘*’ indicates that
the port should be available from all interfaces.
如此大部分的数据分析都可以用HPC来做了,有望实现数据分析的大一统。
在HPC上还有个优点,数据管理比较规范,数据也不容易丢失。
一些基本配置:
.libPaths()
.libPaths("/home/-/softwares/R_lib_361") install.packages('IRkernel')
IRkernel::installspec() install.packages("devtools", dependencies=TRUE, INSTALL_opts = c('--no-lock'))
library(devtools)
nb添加目录
pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
参考:
https://raw.githubusercontent.com/jalvesaq/Nvim-R/master/doc/Nvim-R.txt
https://gist.github.com/tgirke/7a7c197b443243937f68c422e5471899
在HPC的节点上使用jupyter notebook的更多相关文章
- 在Linux服务器上运行Jupyter notebook server教程
在Linux服务器上运行Jupyter notebook server教程 很多deep learning教程都推荐在jupyter notebook运行python代码,方便及时交互.但只在本地运行 ...
- vps上搭建jupyter notebook远程服务
安装anaconda 使用如下命令下载: wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh 如果非roo ...
- 本地主机访问远程linux系统服务器上的jupyter notebook
1,机器情况:服务器 centos python环境已经配置好了,在虚拟环境下安装了anaconda 并且在里面安装了jupyter notebook 2,主机是 windows ipytho ...
- 如何在Windows上的Jupyter Notebook中安装和运行PySpark
When I write PySpark code, I use Jupyter notebook to test my code before submitting a job on the clu ...
- 利用本地浏览器远程服务器上的jupyter notebook
windows中访问远程服务器的方式有很多种:使用windows系统自带的网络功能,直接输入服务器地址访问:使用putty软件远程访问:使用xftp软件登陆:还可以使用x2go客户端图形界面远程访问. ...
- 使用服务器上的Jupyter notebook。
1.jupyter notebook --generate-config #产生配置文件 2.from notebook.auth import passwd #进入python环境,生成密码密文.第 ...
- 在树莓派上搭建jupyter notebook server
自从搬家后,树莓派闲置了好一段时间,最近打算将其利用起来.想来想去,搭个jupyter notebook用要靠谱的,毕竟经常要实验一些Python脚本. 具体过程参考以下链接: https://www ...
- CDH 集群机器上部署 Jupyter notebook 使用 Pyspark 读取 Hive 数据库
开始直接在 CDH Pyspark 的环境里面运行 Ipython . spark = SparkSession \ .builder \ .master('yarn') \ .appName('md ...
- 服务器上搭建jupyter notebook
参考:https://zhuanlan.zhihu.com/p/44405596 https://blog.csdn.net/cvMat/article/details/79351420 遇到的问题 ...
随机推荐
- service基础概念和操作
sevice概念介绍 service的实现强烈依赖于kube-DNS组件 新版本k8s安装的是core-DNS 因为每个pod是有生命周期的 为了给客户端访问pod提供一个固定的访问端点 servic ...
- Spark排序方式集锦
一.简介 spark中的排序一般可以使用orderBy或sort算子,可以结合负号.ASC/DESC和col进行简单排序.二次排序等情况 二.代码实现 package big.data.analyse ...
- 你遇到过哪些原因造成MySQL异步复制延迟?
master上多为并发事务,salve上则多为单线程回放(MySQL 5.7起,支持真正的并行回放,有所缓解) 异步复制,本来就是有一定延迟的(否则也不叫做异步了,介意的话可以改成半同步复制) sla ...
- MAC安装配置maven环境变量
1.下载maven包: 下载链接:
- 202. 快乐数.Set去重作用实际作用
编写一个算法来判断一个数是不是“快乐数”. 一个“快乐数”定义为:对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和,然后重复这个过程直到这个数变为 1,也可能是无限循环但始终变不到 1.如 ...
- Httpd服务入门知识-Httpd服务常见配置案例之虚拟主机
Httpd服务入门知识-Httpd服务常见配置案例之虚拟主机 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.虚拟主机实现方案 1>.Apache httpd 有三种实现虚 ...
- CentOS7 编译安装MySQL5.6.38(一)
一.下载MySQL5.6.38安装包 下载地址:https://www.mysql.com/downloads/ 打开网站之后选择Archives 然后再选择开源版本 选择我们要下载的版本: htt ...
- git命令中的--是什么意思?
转载自git命令中的--是什么意思? git命令中的--是什么意思? 看到个命令 git checkout -- files 不知道--代表什么.查了一下,--是linux的东西,用来标志命令项的结束 ...
- Codeforces C Match Points(二分贪心)
题目描述: Match Points time limit per test 2 seconds memory limit per test 256 mega bytes input standard ...
- python正则表达式(5)--findall、finditer方法
findall方法 相比其他方法,findall方法有些特殊.它的作用是查找字符串中所有能匹配的字符串,并以结果存于列表中,然后返回该列表 注意: match 和 search 是匹配一次 finda ...