投递任务,注意资源设置

#!/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

  

  

参考:

Jupyter on the Cluster

https://raw.githubusercontent.com/jalvesaq/Nvim-R/master/doc/Nvim-R.txt

https://gist.github.com/tgirke/7a7c197b443243937f68c422e5471899

在HPC的节点上使用jupyter notebook的更多相关文章

  1. 在Linux服务器上运行Jupyter notebook server教程

    在Linux服务器上运行Jupyter notebook server教程 很多deep learning教程都推荐在jupyter notebook运行python代码,方便及时交互.但只在本地运行 ...

  2. vps上搭建jupyter notebook远程服务

    安装anaconda 使用如下命令下载: wget https://repo.continuum.io/archive/Anaconda3-5.0.0.1-Linux-x86_64.sh 如果非roo ...

  3. 本地主机访问远程linux系统服务器上的jupyter notebook

    1,机器情况:服务器 centos python环境已经配置好了,在虚拟环境下安装了anaconda 并且在里面安装了jupyter notebook 2,主机是 windows     ipytho ...

  4. 如何在Windows上的Jupyter Notebook中安装和运行PySpark

    When I write PySpark code, I use Jupyter notebook to test my code before submitting a job on the clu ...

  5. 利用本地浏览器远程服务器上的jupyter notebook

    windows中访问远程服务器的方式有很多种:使用windows系统自带的网络功能,直接输入服务器地址访问:使用putty软件远程访问:使用xftp软件登陆:还可以使用x2go客户端图形界面远程访问. ...

  6. 使用服务器上的Jupyter notebook。

    1.jupyter notebook --generate-config #产生配置文件 2.from notebook.auth import passwd #进入python环境,生成密码密文.第 ...

  7. 在树莓派上搭建jupyter notebook server

    自从搬家后,树莓派闲置了好一段时间,最近打算将其利用起来.想来想去,搭个jupyter notebook用要靠谱的,毕竟经常要实验一些Python脚本. 具体过程参考以下链接: https://www ...

  8. CDH 集群机器上部署 Jupyter notebook 使用 Pyspark 读取 Hive 数据库

    开始直接在 CDH Pyspark 的环境里面运行 Ipython . spark = SparkSession \ .builder \ .master('yarn') \ .appName('md ...

  9. 服务器上搭建jupyter notebook

    参考:https://zhuanlan.zhihu.com/p/44405596 https://blog.csdn.net/cvMat/article/details/79351420 遇到的问题 ...

随机推荐

  1. element-ui 自定义 Upload 上传进度条

    <el-upload class="upload-demo" ref="vidos" :action="URL+'/api/post/file' ...

  2. rabbitmq:配置rabbitmq-management插件

    rabbitmq提供了一个图形的管理界面,用于管理.监控rabbitmq的运行情况,它是以插件的形式提供的,如果要启用需要启用插件 一.启用插件 rabbitmq-plugins enable rab ...

  3. NGINX一览无余

    Nginx 是如何实现高并发的? 异步,非阻塞,使用了epoll 和大量的底层代码优化. 如果一个server采用一个进程负责一个request的方式,那么进程数就是并发数.正常情况下,会有很多进程一 ...

  4. RxJS——调度器(Scheduler)

    调度器 什么是调度器?调度器是当开始订阅时,控制通知推送的.它由三个部分组成. 调度是数据结构.它知道怎样在优先级或其他标准去存储和排队运行的任务 调度器是一个执行上下文.它表示任务在何时何地执行(例 ...

  5. jq 实现切换菜单选中状态

    点击导航菜单,切换选中状态 效果: 思路:首先获取选中的URL,再通过正则判断是否相同,相同就加上相应的属性,不相同就去除相应的属性. html代码 <div class="layui ...

  6. Python卸载不干净?苹果电脑卸载python教程

    如今,Pyhon越来越火,屡次超越Java.C++成为编程语言排行榜第一的语言,国内的公司和程序员们也越来越喜欢使用Python.但是Python安装之后,散落在电脑各处,删除起来比较麻烦,很多小伙伴 ...

  7. FRP 中文文档

    https://github.com/fatedier/frp/blob/master/README_zh.md README | 中文文档 frp 是一个可用于内网穿透的高性能的反向代理应用,支持 ...

  8. Find the median(2019年牛客多校第七场E题+左闭右开线段树)

    题目链接 传送门 题意 每次往集合里面添加一段连续区间的数,然后询问当前集合内的中位数. 思路 思路很好想,但是卡内存. 当时写的动态开点线段树没卡过去,赛后机房大佬用动态开点过了,\(tql\). ...

  9. Java并发编程:ThreadPoolExecutor + Callable + Future(FutureTask) 探知线程的执行状况

    如题 (总结要点) 使用ThreadPoolExecutor来创建线程,使用Callable + Future 来执行并探知线程执行情况: V get (long timeout, TimeUnit ...

  10. c小例子 10个数找出第一名

    这个小例子,是从十个数中找到第一名,如果第一名的分数相同,则二者都可以晋级,进入下一轮比赛,我们就对这个数进行排序,这样要求输出晋级人员的标号0-9号中其中一个或几个. 如何用c语言来实现呢? 1) ...