From T3_KR_KNU
Jump to: navigation, search
(pip를 이용하여 사용자 커널 추가)
(사용자 커널 추가하기)
 
(12 intermediate revisions by one other user not shown)
Line 20: Line 20:
  
 
* python                    2.7.15
 
* python                    2.7.15
* htcondor api 8.9.5
+
* htcondor 8.9.5
 
* matplotlib 2.2.5
 
* matplotlib 2.2.5
 
* numpy 1.16.5
 
* numpy 1.16.5
  
===== Python 3.6 =====
+
===== Python 3.6 (ROOT) =====
  
 
* python                    3.6.13
 
* python                    3.6.13
Line 31: Line 31:
 
* matplotlib                3.3.4
 
* matplotlib                3.3.4
 
* numpy                    1.19.5
 
* numpy                    1.19.5
 
===== Python 3.6 (PyROOT)  =====
 
 
* python                    3.6.7
 
* root 6.20.2
 
* matplotlib                3.3.4
 
* numpy 1.18.1
 
  
 
===== Python 3.7 (TF_CPU)  =====
 
===== Python 3.7 (TF_CPU)  =====
Line 45: Line 38:
 
* matplotlib                3.5.1
 
* matplotlib                3.5.1
 
* numpy                    1.21.5
 
* numpy                    1.21.5
 +
 +
===== ROOT C++ (6.24/02)  =====
 +
 +
* root                        6.24.2
  
 
==== 사용자 커널 추가하기 ====
 
==== 사용자 커널 추가하기 ====
Line 50: Line 47:
 
* 기본 제공 커널에서 사용자가 원하는 패키지가 없거나 특정한 버전의 패키지가 필요하다면 자신이 원하는 구성으로 사용자 커널을 추가할 수 있습니다.
 
* 기본 제공 커널에서 사용자가 원하는 패키지가 없거나 특정한 버전의 패키지가 필요하다면 자신이 원하는 구성으로 사용자 커널을 추가할 수 있습니다.
  
===== pip를 이용하여 사용자 커널 추가 =====
+
* anaconda3 환경설정 로딩
 
+
* ananconda3 환경설정 로딩
+
  
 
  $ . /opt/anaconda3/anaconda3.sh
 
  $ . /opt/anaconda3/anaconda3.sh
  
* 가상환경 추가 및 패키지 설치, (가상환경 이름: ipykernel_py3.7)
+
* 가상환경 추가 및 패키지 설치 (가상환경이름: ipykernel_py3.7)
  
  $ virtualenv ''ipykernel_py3.7'' --python=''3.7''
+
  $ conda create -n ''ipykernel_py3.7'' python=3.7 ipykernel
  $ source ''ipykernel_py3.7''/bin/activate
+
  $ conda activate ''ipykernel_py3.7''
  $ pip install ''matplotlib''
+
  $ conda install -c conda-forge ''matplotlib''
  
 
* 커널 추가 (커널이름: python3.7, 메뉴표시이름: Python(3.7))
 
* 커널 추가 (커널이름: python3.7, 메뉴표시이름: Python(3.7))
  $ ipython kernel install --user --name ''python3.7'' --display-name "''Python(3.7)''"
+
  $ ipython kernel install --user --name ''python3.7'' --display-name "Python(3.7)"
  
 
* 커널 조회
 
* 커널 조회
Line 69: Line 64:
  
 
* 커널 삭제
 
* 커널 삭제
  $ jupyter kernelspec uninstall ''python3.7''
+
  $ jupyter kernelspec uninstall "python3.7"
  
===== conda를 이용하여 사용자 커널 추가 =====
+
=== HTCondor Python API ===
  
* ananconda3 환경설정 로딩
+
* HTCondor Python API를 이용하면 jupyter 환경에서 htcondor 를 사용할수 있습니다.
 +
* [https://htcondor.readthedocs.io/en/latest/apis/python-bindings/tutorials/index.html HTCondor Python Bindings Tutorials]
 +
* [https://htcondor.readthedocs.io/en/latest/apis/python-bindings/tutorials/Submitting-and-Managing-Jobs.html Submitting and Managing Jobs]
 +
* [https://htcondor.readthedocs.io/en/latest/apis/python-bindings/tutorials/Advanced-Job-Submission-And-Management.html Advanced Job Submission and Management]
 +
* 위 문서중에 있는 [launch binder]를 클릭하면 해당 예제를 실습해볼수 있습니다.
  
$ . /opt/anaconda3/anaconda3.sh
+
=== ROOT ===
  
* 가상환경 추가 및 패키지 설치
+
* C++ ROOT
  
  $ conda create -n ipykernel_py3.7 python=3.7 ipykernel
+
  TCanvas c;
  $ conda activate ipykernel_py3.7
+
TH1F h("h","ROOT Histo;X;Y",64,-4,4);
  $ conda install -c conda-forge matplotlib
+
h.FillRandom("gaus");
 +
  h.Draw();
 +
  c.Draw();
  
* 커널 추가
+
[[File:root_c_ex1.png|700px]]
$ conda activate ipykernel_py3.7
+
$ ipython kernel install --user --name python3.7 --display-name "Python(3.7)"
+
  
* 커널 조회
+
* Python ROOT
$ jupyter kernelspec list
+
  
* 커널 삭제
+
  import ROOT
  $ jupyter kernelspec uninstall 커널이름
+
  
=== HTCondor Python API ===
+
c = ROOT.TCanvas("c")
 +
h = ROOT.TH1F("h","ROOT Histo;X;Y",64,-4,4)
  
* HTCondor Python API를 이용하면 jupyter 환경에서 htcondor 를 사용할수 있습니다.
+
%%cpp
* [https://htcondor.readthedocs.io/en/latest/apis/python-bindings/tutorials/index.html HTCondor Python Bindings Tutorials]
+
h->FillRandom("gaus");
* [https://htcondor.readthedocs.io/en/latest/apis/python-bindings/tutorials/Submitting-and-Managing-Jobs.html Submitting and Managing Jobs]
+
h->Draw();
* [https://htcondor.readthedocs.io/en/latest/apis/python-bindings/tutorials/Advanced-Job-Submission-And-Management.html Advanced Job Submission and Management]
+
c->Draw();
* 위 문서중에 있는 [launch binder]를 클릭하면 해당 예제를 실습해볼수 있습니다.
+
  
=== PyROOT ===
+
[[File:root_py_ex1.png|700px]]
  
 +
* https://github.com/root-project/root/tree/master/bindings/jupyroot
 
* [https://root.cern/doc/master/group__tutorial__pyroot.html PyRoot tutorials]
 
* [https://root.cern/doc/master/group__tutorial__pyroot.html PyRoot tutorials]
  
Line 109: Line 107:
 
* 현재 jupyterhub에서는 tensoflow cpu 만 사용할 수 있습니다.
 
* 현재 jupyterhub에서는 tensoflow cpu 만 사용할 수 있습니다.
 
* tensorflow gpu의 사용을 위해서는 기존과 같이 htcondor를 이용해야합니다.
 
* tensorflow gpu의 사용을 위해서는 기존과 같이 htcondor를 이용해야합니다.
 +
 +
=== 기타 ===
 +
 +
==== 단축키 ====
 +
* [https://ljs93kr.tistory.com/54 Jupyter notebook 단축키 정리]

Latest revision as of 06:54, 6 April 2022

1 JupyterHub

1.1 소개

  • jupyterhub는 jupyter notebook을 다중 사용자가 사용할 수 있도록 만들어진 환경입니다.
  • 아래 주소를 이용하여 경북대 Tier3 jupyterhub에 접속할 수 있습니다.
  • https://cms.knu.ac.kr:8000

1.2 커널

  • 노트북 커널은 노트북 문서에 포함 된 코드를 실행하는 "계산 엔진"입니다.

1.2.1 기본 제공 커널

1.2.1.1 Python 3
  • python 3.9.7
1.2.1.2 Python 2.7
  • python 2.7.15
  • htcondor 8.9.5
  • matplotlib 2.2.5
  • numpy 1.16.5
1.2.1.3 Python 3.6 (ROOT)
  • python 3.6.13
  • root 6.24.2
  • htcondor 9.1.2
  • matplotlib 3.3.4
  • numpy 1.19.5
1.2.1.4 Python 3.7 (TF_CPU)
  • python 3.7.12
  • tensorflow 2.7.0
  • matplotlib 3.5.1
  • numpy 1.21.5
1.2.1.5 ROOT C++ (6.24/02)
  • root 6.24.2

1.2.2 사용자 커널 추가하기

  • 기본 제공 커널에서 사용자가 원하는 패키지가 없거나 특정한 버전의 패키지가 필요하다면 자신이 원하는 구성으로 사용자 커널을 추가할 수 있습니다.
  • anaconda3 환경설정 로딩
$ . /opt/anaconda3/anaconda3.sh
  • 가상환경 추가 및 패키지 설치 (가상환경이름: ipykernel_py3.7)
$ conda create -n ipykernel_py3.7 python=3.7 ipykernel
$ conda activate ipykernel_py3.7
$ conda install -c conda-forge matplotlib
  • 커널 추가 (커널이름: python3.7, 메뉴표시이름: Python(3.7))
$ ipython kernel install --user --name python3.7 --display-name "Python(3.7)"
  • 커널 조회
$ jupyter kernelspec list 
  • 커널 삭제
$ jupyter kernelspec uninstall "python3.7"

1.3 HTCondor Python API

1.4 ROOT

  • C++ ROOT
TCanvas c;
TH1F h("h","ROOT Histo;X;Y",64,-4,4);
h.FillRandom("gaus");
h.Draw();
c.Draw();

Root c ex1.png

  • Python ROOT
import ROOT
c = ROOT.TCanvas("c")
h = ROOT.TH1F("h","ROOT Histo;X;Y",64,-4,4)
%%cpp
h->FillRandom("gaus");
h->Draw();
c->Draw();

Root py ex1.png

1.5 tensorflow

  • 현재 jupyterhub에서는 tensoflow cpu 만 사용할 수 있습니다.
  • tensorflow gpu의 사용을 위해서는 기존과 같이 htcondor를 이용해야합니다.

1.6 기타

1.6.1 단축키