% =========================================================
%   AIPub(AI-X) H100 워크스페이스 사용 매뉴얼 (한국어판) v2.2 — 공개용
%   for 전일제 연구원 / base theme by 이상완
%
%   v2 변경점: 파일 옮기기(다운로드 & 업로드) 챕터 추가
%   v2.1 변경점: 랩 운영 규칙 반영 (2026-06 세미나 안)
%   v2.2 변경점: 코드블록(listings) 내 한글 깨짐 수정
%
%   [공개용 조치] 포트폴리오 게재를 위해 내부 접속 주소, 계정/볼륨명,
%   IP·포트, 전화번호, 프로젝트·리소스셋 이름은 예시 값으로 마스킹했습니다.
%   (예: 계정·볼륨 lab, 주소 main.aipub.univ.ac.kr, IP 203.0.113.10)
% =========================================================
\documentclass[aspectratio=169]{beamer}
\usepackage{kotex}
\usepackage{fontspec}
\usepackage{listings}
\usepackage{xcolor}

% !TEX program = xelatex

\usetheme{metropolis}
\usefonttheme{professionalfonts}

% -------- 전남대 컬러 팔레트 --------
\definecolor{jnuGreen}{RGB}{0, 102, 51}
\definecolor{jnuLight}{RGB}{139, 195, 74}
\definecolor{jnuRed}{RGB}{200, 16, 46}
\definecolor{jnuGold}{RGB}{218, 165, 32}
\definecolor{jnuBrown}{RGB}{92, 64, 51}
\definecolor{jnuBG}{RGB}{250, 250, 247}
\definecolor{jnuDark}{RGB}{33, 37, 41}

% -------- 한글 폰트: 빌드 환경에 있는 폰트를 자동 선택 --------
\IfFontExistsTF{NanumBarunGothic}{%
  \setmainhangulfont{NanumBarunGothic}[BoldFont={NanumBarunGothicBold}]%
  \setsanshangulfont{NanumBarunGothic}[BoldFont={NanumBarunGothicBold}]%
}{%
  \IfFontExistsTF{Noto Sans CJK KR}{%
    \setmainhangulfont{Noto Sans CJK KR}%
    \setsanshangulfont{Noto Sans CJK KR}%
  }{%
    \setmainhangulfont{UnDotum}%
    \setsanshangulfont{UnDotum}%
  }%
}

\setbeamercolor{normal text}{fg=jnuDark, bg=jnuBG}
\setbeamercolor{frametitle}{fg=white, bg=jnuGreen}
\setbeamercolor{title}{fg=jnuGreen}
\setbeamercolor{subtitle}{fg=jnuBrown}
\setbeamercolor{author}{fg=jnuDark}
\setbeamercolor{institute}{fg=jnuBrown}
\setbeamercolor{date}{fg=jnuBrown}
\setbeamercolor{progress bar}{fg=jnuRed}
\setbeamercolor{alerted text}{fg=jnuRed}
\setbeamercolor{section in toc}{fg=jnuGreen}
\setbeamercolor{block title}{bg=jnuGreen, fg=white}
\setbeamercolor{block body}{bg=jnuBG!50!white, fg=jnuDark}

\definecolor{codeBG}{RGB}{245, 245, 240}
\definecolor{codeKey}{RGB}{0, 102, 51}
\definecolor{codeStr}{RGB}{200, 16, 46}
\definecolor{codeCmt}{RGB}{120, 120, 110}
\definecolor{codeNum}{RGB}{218, 165, 32}

\lstdefinestyle{jnustyle}{
    backgroundcolor=\color{codeBG},
    commentstyle=\color{codeCmt}\itshape,
    keywordstyle=\color{codeKey}\bfseries,
    numberstyle=\tiny\color{codeCmt},
    stringstyle=\color{codeStr},
    basicstyle=\ttfamily\footnotesize,
    breakatwhitespace=false,
    breaklines=true,
    captionpos=b,
    keepspaces=true,
    numbers=left,
    numbersep=8pt,
    showspaces=false,
    showstringspaces=false,
    showtabs=false,
    tabsize=4,
    frame=leftline,
    rulecolor=\color{jnuGreen},
    framerule=2pt,
    xleftmargin=12pt,
}
\lstset{style=jnustyle}

\title{H100 GPU 사용 매뉴얼 (v2.2 공개용)}
\subtitle{워크스페이스 만들기부터 GPU 작업, 파일 전송까지}
\author{이상완}
\institute{전남대학교 D-AI연구실}
\date{2026년 6월}

\begin{document}

\frame{\titlepage}

\begin{frame}{목차}
    \tableofcontents
\end{frame}

% =========================================================
%  길 안내 (두 갈래)
% =========================================================
\begin{frame}{이 매뉴얼 사용법 — 먼저 읽으세요}
    \begin{itemize}
        \item \textbf{이미 만들어진 워크스페이스를 쓰는 경우} (대부분의 동료)
        \\ $\rightarrow$ \alert{본론(들어가서 쓰기)}부터 보면 됩니다. 부록은 볼 필요 없어요.
        \item \textbf{워크스페이스를 처음 만드는 경우} (관리자 / 최초 1회)
        \\ $\rightarrow$ 맨 뒤 \alert{부록(워크스페이스 만들기)}을 먼저 보세요.
    \end{itemize}
    \vspace{0.8em}
    \begin{block}{우리 연구실 사용 방식}
        연구실 대표 계정(\texttt{lab})으로 만든 \alert{워크스페이스 하나를 다 같이} 사용합니다.
        그래서 대부분은 \textbf{만들 필요 없이} 바로 들어가서 쓰면 됩니다.
    \end{block}
\end{frame}

% =========================================================
\section{시작하기 전에}
% =========================================================

\begin{frame}{이 매뉴얼은}
    \begin{itemize}
        \item 우리 연구실 \textbf{H100 GPU}를 쓰기 위한 \textbf{AIPub} 사용법입니다.
        \item 주소: \texttt{https://main.aipub.univ.ac.kr} \footnotesize(공개용 마스킹 주소)\normalsize
        \item 흐름: \textbf{접속 $\rightarrow$ 들어가기 $\rightarrow$ 환경 준비 $\rightarrow$ GPU 작업 $\rightarrow$ 파일 옮기기 $\rightarrow$ 정리}
        \item \alert{명령어를 몰라도 됩니다.} 화면과 복붙(복사-붙여넣기)만 따라오세요.
    \end{itemize}
    \vspace{0.8em}
    \begin{block}{용어 한 줄 정리}
        \textbf{워크스페이스 = 우리가 같이 쓰는 H100 컴퓨터 한 대} (= 컨테이너)
    \end{block}
\end{frame}

\begin{frame}{딱 세 가지만 기억하세요}
    \begin{enumerate}
        \item \alert{반드시 교내망에서만} 사용 (집 등 학교 밖에서는 접속 안 됨)
        \item \alert{공유 계정}입니다. Pause 누르기 전 다른 사람이 쓰는지 꼭 확인
        \item \alert{중요한 파일은 \texttt{/lab} 안에} 저장 (컨테이너 안은 재시작하면 사라짐)
    \end{enumerate}
    \vspace{1em}
    \begin{center}
        \alert{\large 이 세 가지가 사고의 대부분입니다.}
    \end{center}
\end{frame}

\begin{frame}{0단계 — 접속 (교내망 전용)}
    \begin{block}{\alert{반드시 교내망에서만 사용}}
        이 시스템은 \alert{교내망 안에서만} 사용하도록 권고합니다.
    \end{block}
    \vspace{0.6em}
    \begin{itemize}
        \item 교내(연구실 PC, 캠퍼스 와이파이) $\rightarrow$ 정상 접속됩니다.
        \item 집 등 학교 밖 $\rightarrow$ 주소를 입력해도 \textbf{접속되지 않습니다}(무한 로딩). 고장이 아니라 보안 정책입니다.
        \item 따라서 \alert{교외(집 등)에서는 사용하지 마세요.} 작업은 교내에서 진행해 주세요.
    \end{itemize}
\end{frame}

\begin{frame}{0-A단계 — 보안 경고는 정상입니다 \alert{(당황 금지)}}
    처음 접속하면 아래 같은 경고가 뜹니다. \alert{이 사이트에 한해 정상이니} 그대로 진행하세요.
    \vspace{0.4em}
    \begin{block}{이런 화면이 떠요}
        ``연결이 비공개로 설정되어 있지 않습니다'' / \texttt{NET::ERR\_CERT\_AUTHORITY\_INVALID}
    \end{block}
    \begin{itemize}
        \item 이유: 학내 시스템이 \textbf{자체 보안 인증서}를 써서 그렇습니다. 위험한 사이트가 아닙니다.
        \item \textbf{Chrome/Edge}: \textbf{고급} 클릭 $\rightarrow$ \textbf{``(사이트 주소)(으)로 이동''} 클릭
        \item \textbf{Safari}: \textbf{세부사항 보기} $\rightarrow$ \textbf{``이 웹사이트 방문''} 클릭
    \end{itemize}
    \vspace{0.3em}
    \footnotesize \alert{주의:} 이 통과는 해당 학내 시스템 \alert{한 곳에서만} 하세요. 다른 사이트에서 같은 경고가 뜨면 함부로 통과하지 마세요.
\end{frame}

% =========================================================
\section{들어가서 작업하기}
% =========================================================

\begin{frame}[fragile]{빠른 시작 요약 \alert{(익숙해지면 이 한 장만)}}
    교내망에서 시스템 로그인(보안경고 통과) 후:
\begin{lstlisting}[language=bash]
# 1) Click workspace name -> Web Terminal

# 2) Activate env (after restart, reinstall python only)
apt update && apt install -y python3
source /lab/shared/env/bin/activate

# 3) Work in your own folder
cd /lab/yourname

# 4) When done: check others, then Pause
\end{lstlisting}
    \footnotesize \alert{핵심 3가지:} 교내망만 / 파일은 \texttt{/lab} 안에 / Pause 전 다른 사람 확인.
    \\ \footnotesize (\texttt{yourname} 자리엔 본인 폴더명 --- 영문 이름 권장)
    \\ 자세한 설명은 다음 장부터. 처음이면 차근차근 따라오세요.
\end{frame}

\begin{frame}{1단계 — Web Terminal로 들어가기}
    \begin{enumerate}
        \item \textbf{Workspaces} 목록에서 우리 워크스페이스 \textbf{이름} 클릭
        \item 상세 화면 오른쪽 아래 \textbf{Web Terminal} 클릭
        \item 새 창에 \textbf{까만 터미널}이 열립니다 --- 여기가 H100 안입니다.
    \end{enumerate}
    \vspace{0.5em}
    \begin{block}{\alert{입력이 안 될 때} (자주 겪음)}
        \begin{itemize}
            \item \alert{키 입력이 안 되면} $\rightarrow$ \alert{한/영 키를 눌러 영문 입력 상태로} 바꾸세요.
            \\ \footnotesize 한글 입력 상태에서는 터미널에 입력이 안 됩니다.
            \item \alert{커서가 안 깜빡이고 비어 있으면} $\rightarrow$ 컨테이너 준비 중일 수 있어요.
            상태가 \texttt{Available}인지 확인하고, 창을 닫았다가 \textbf{Web Terminal}을 다시 누르세요.
        \end{itemize}
    \end{block}
    \footnotesize 한 번 만들어진 워크스페이스는 \alert{어느 PC에서든 Web Terminal}로 들어갈 수 있어요(SSH 키 불필요).
\end{frame}

\begin{frame}[fragile]{2단계 — GPU 진짜 있는지 확인}
    터미널에 입력:
\begin{lstlisting}[language=bash]
nvidia-smi
\end{lstlisting}
    아래처럼 \alert{NVIDIA H100 80GB}가 보이면 성공입니다.
\begin{lstlisting}
NVIDIA-SMI 595.71.05   Driver: 595.71.05   CUDA: 13.2
GPU  Name                  Memory-Usage    GPU-Util
 0   NVIDIA H100 80GB HBM3  69MiB/81559MiB    0%
\end{lstlisting}
    \footnotesize 80GB(81559MiB)짜리 GPU가 통째로 잡혀 있는 게 보이죠?
\end{frame}

\begin{frame}[fragile]{3단계 — 환경 켜기 (평소: 거의 매번 이것만)}
    이 이미지는 깡통이라, 재시작하면 \alert{시스템 파이썬은 날아갑니다}. 하지만 PyTorch는
    공용 venv(\texttt{/lab/shared/env})에 \alert{살아있어} 다시 설치할 필요가 없습니다.
\begin{lstlisting}[language=bash]
# 1) Reinstall python only (tens of seconds, faster than torch)
apt update && apt install -y python3

# 2) Activate shared env (torch already inside)
source /lab/shared/env/bin/activate
\end{lstlisting}
    \begin{block}{확인}
        \texttt{python3 -c "import torch; print(torch.cuda.is\_available())"} $\rightarrow$ \texttt{True}
    \end{block}
    \footnotesize 프롬프트 앞에 \texttt{(env)}가 보이면 환경이 켜진 것. \alert{torch 재설치 안 해도 됩니다.}
\end{frame}

\begin{frame}[fragile]{3단계 (참고) — 공용 venv가 \alert{없을} 때만 (최초 1회)}
    \texttt{source}에서 ``그런 파일 없음'' 에러가 나면, 공용 환경이 아직 없는 것. \alert{최초 1회만} 만듭니다.
\begin{lstlisting}[language=bash]
apt update && apt install -y python3 python3-venv python3-pip
mkdir -p /lab/shared
python3 -m venv /lab/shared/env
source /lab/shared/env/bin/activate
pip install torch numpy      # large, takes a few min - only once
\end{lstlisting}
    \footnotesize 이건 \alert{누군가 한 번만} 하면, 이후 모두가 위 3단계(평소)처럼 \texttt{activate}만 하면 됩니다.
    공용 환경이니 \alert{함부로 패키지를 지우지 마세요.}
\end{frame}

\begin{frame}[fragile]{4단계 — 토이 프로젝트: GPU 진짜 도는지 확인}
    테스트용 파일 \texttt{/lab/gpu\_test.py}를 \alert{미리 만들어 두었습니다.} 잘 실행되는지만 확인하세요.
\begin{lstlisting}[language=bash]
# (env must be activated, see step 3)
python3 /lab/gpu_test.py
\end{lstlisting}
    아래처럼 나오면 \alert{H100에서 실제로 계산이 돈 것}입니다:
    \begin{block}{출력 예시}
        \ttfamily\footnotesize
        GPU 사용 가능: True \\
        GPU 이름: NVIDIA H100 80GB HBM3 \\
        연산 완료! 결과 크기: torch.Size([8000, 8000])
    \end{block}
    \begin{center}
        \alert{\large 축하합니다 --- GPU 작업 성공!}
    \end{center}
    \footnotesize 내 코드로 바꿔 쓰려면 \texttt{cp /lab/gpu\_test.py /lab/본인폴더/} 로 복사 후 수정하세요. 실제 연구 코드도 \texttt{device="cuda"}만 붙이면 GPU에서 돕니다.
\end{frame}

% =========================================================
\section{파일 옮기기 — 다운로드 \& 업로드 (v2 신규)}
% =========================================================

\begin{frame}{파일 옮기기 — 길은 딱 두 갈래}
    \textbf{파일이 지금 어디 있느냐}로 방법이 갈립니다.
    \begin{itemize}
        \item \textbf{인터넷에 있는 파일} (공개 데이터셋, 깃허브 코드 등)
        \\ $\rightarrow$ \alert{Web Terminal에서 \texttt{wget} / \texttt{git clone}} --- 키 불필요, 제일 쉬움. \textbf{(주력)}
        \item \textbf{내 노트북에만 있는 파일} (직접 만든 데이터·코드)
        \\ $\rightarrow$ \alert{SFTP 서버로 직접 업로드} --- 본인 키 필요, \alert{유선 교내망에서만}.
    \end{itemize}
    \vspace{0.6em}
    \begin{block}{한 줄 요약}
        \textbf{받기는 터미널에서(\texttt{wget}/\texttt{git}), 올리기는 SFTP로.}
        대부분의 경우는 받기만으로 충분합니다.
    \end{block}
\end{frame}

\begin{frame}[fragile]{받기 — \texttt{wget} / \texttt{git clone} (키 불필요, 제일 쉬움)}
    인터넷에 있는 건 노트북을 거치지 말고 \alert{Web Terminal에서 바로} 받으세요. 그게 제일 빠릅니다.
\begin{lstlisting}[language=bash]
# (after restart) install tools
apt update && apt install -y wget git

# move into your folder, then download
mkdir -p /lab/yourname && cd /lab/yourname
wget https://...DOWNLOAD_URL
git clone https://github.com/USER/REPO.git
\end{lstlisting}
    \footnotesize \texttt{yourname}=본인 폴더, \texttt{DOWNLOAD\_URL}=받을 주소, \texttt{USER/REPO}=깃허브 계정/저장소.
    \begin{itemize}
        \item 공용 데이터셋은 \alert{\texttt{/lab/shared/}에 한 번만} 받아 같이 쓰기 (사람마다 중복 금지)
        \item 노트북 파일도 \textbf{GitHub에 올린 뒤 \texttt{clone}}하는 우회가 가능
        \\ \footnotesize (단, 파일당 100MB 제한 / 비공개 repo는 GitHub 토큰 필요 / 민감한 데이터는 public 금지)
    \end{itemize}
\end{frame}

\begin{frame}{올리기 — SFTP, 시작 전에 \alert{수칙 3가지}}
    내 노트북에만 있는 파일을 직접 올릴 때 씁니다. 시작 전 이것만 기억하세요.
    \begin{enumerate}
        \item \alert{반드시 유선 교내망에서.} 와이파이·개인 공유기 망에서는 \texttt{Operation timed out}만 뜹니다.
        \\ \footnotesize 이건 \textbf{설정 문제가 아니라 망 차단}입니다. 아무리 다시 시도해도 안 됩니다.
        \item \alert{본인 공개키로 본인 SFTP 서버를} 만듭니다. (워크스페이스의 키와 별개)
        \item \alert{다 쓰면 Delete.} SFTP 서버는 개인 소모품 --- 지워도 \texttt{/lab} 파일은 그대로 남습니다.
    \end{enumerate}
    \vspace{0.5em}
    \begin{block}{헷갈리지 마세요 --- 수명 정책이 정반대}
        \textbf{워크스페이스} = 공유물 하나. Delete \alert{절대 금지}, 끝나면 Pause. \\
        \textbf{SFTP 서버} = 개인 소모품. 필요할 때 본인 키로 만들고, 끝나면 \alert{Delete OK}.
    \end{block}
\end{frame}

\begin{frame}[fragile]{올리기 ① — SFTP 서버 만들기 (필요할 때마다, 2분)}
    \begin{enumerate}
        \item 왼쪽 메뉴 \textbf{SFTPServers} $\rightarrow$ 오른쪽 위 \textbf{+ Create}
        \item \textbf{Volume}: \alert{\texttt{lab}} 선택 (그래야 워크스페이스의 \texttt{/lab}과 같은 곳에 올라감)
        \item \textbf{Public key}: 본인 \texttt{id\_rsa.pub} 붙여넣기 \footnotesize(키가 없으면 부록 D와 같은 방법으로 생성)\normalsize
        \item 생성 후 상세 화면 \textbf{Connection information}에서 \alert{Host / Port / User(\texttt{aipub})} 확인
    \end{enumerate}
    \footnotesize \alert{주의:} 포트는 \alert{만들 때마다 바뀝니다.} 외우지 말고 매번 화면에서 복사하세요.
    \vspace{0.4em}

    \textbf{(최초 1회) 업로드 폴더 권한 열기} --- \textbf{Web Terminal}에서:
\begin{lstlisting}[language=bash]
mkdir -p /lab/yourname
chmod 777 /lab/yourname
\end{lstlisting}
    \footnotesize SFTP는 \texttt{aipub} 사용자로 들어와서 root 소유 폴더에는 못 씁니다. 이걸 안 하면 \alert{Permission denied}가 뜹니다. (\texttt{yourname}=본인 폴더명)
\end{frame}

\begin{frame}[fragile]{올리기 ② — 접속해서 업로드 \alert{(유선에서!)}}
    본인 PC 터미널에서 (호스트·포트는 SFTP 서버 상세 화면 값으로):
\begin{lstlisting}[language=bash]
sftp -i ~/.ssh/id_rsa -P PORT aipub@HOST

# first time it asks to trust the host -> type "yes" in full (not "y")
# prompt changes to  sftp>  then:

lcd LOCAL_DIR     # "l" prefix = my laptop side
lls               # list laptop files
cd /lab/yourname  # no prefix = server side
put FILENAME      # upload!  (whole folder: put -r FOLDER)
bye               # quit
\end{lstlisting}
    \footnotesize 예: \texttt{sftp -i \textasciitilde/.ssh/id\_rsa -P 56342 aipub@203.0.113.10} \footnotesize(예시 IP)\normalsize
    \\ \alert{핵심:} 신뢰 질문엔 \alert{\texttt{yes}를 풀로}(\texttt{y} 안 됨), 명령 앞 \texttt{l}이 붙으면 내 노트북 쪽 / 안 붙으면 서버 쪽.
    \\ Windows도 PowerShell에서 같은 명령 그대로 됩니다 (키 경로: \texttt{\%userprofile\%\textbackslash.ssh\textbackslash id\_rsa}).
    \\ \alert{확인:} Web Terminal에서 \texttt{ls /lab/yourname} $\rightarrow$ 파일이 보이면 성공!
    \\ GUI가 편하면 \textbf{WinSCP}(프로토콜 SFTP, 같은 호스트·포트·\texttt{aipub}·개인키)로 드래그해도 똑같습니다.
\end{frame}

\begin{frame}{올리기 ③ — 끝나면 Delete \& 막혔을 때}
    \begin{block}{끝나면 정리}
        업로드가 끝나면 SFTP 서버는 \alert{Delete} 하세요. 열린 포트를 줄이는 보안 습관이고,
        \texttt{/lab}의 파일은 \textbf{안 사라집니다.} 다음에 필요하면 같은 키로 또 만들면 됩니다(1분).
    \end{block}
    \vspace{0.4em}
    \textbf{막혔을 때 (증상 $\rightarrow$ 처방):}
    \begin{itemize}
        \item \texttt{Operation timed out} $\rightarrow$ \alert{십중팔구 망 문제.} 유선 교내망인지 확인 (와이파이·개인 공유기는 차단). 명령·키 잘못이 아닙니다
        \item \texttt{Host key verification failed} $\rightarrow$ 신뢰 질문에 \alert{\texttt{yes}를 풀로} 입력 (\texttt{y}는 안 됨)
        \item \texttt{Permission denied} $\rightarrow$ Web Terminal에서 \texttt{chmod 777 /lab/본인폴더} (올리기 ① 참고)
        \item 접속 정보가 안 맞음 $\rightarrow$ 포트는 재생성 시 바뀜. 상세 화면에서 \alert{현재 값}을 다시 복사
    \end{itemize}
\end{frame}

% =========================================================
\section{파일 관리 \& 공유 규칙}
% =========================================================

\begin{frame}[fragile]{파일은 어디에 저장? \alert{(데이터 증발 주의)}}
    \begin{block}{\alert{컨테이너 안에 저장한 건 재시작하면 다 사라집니다}}
        설치한 파이썬/torch, \texttt{/root}나 아무 데나 만든 파일은 \alert{초기화}됩니다.
    \end{block}
    \vspace{0.4em}
    살아남는 곳은 \alert{볼륨 \texttt{/lab} 한 곳뿐}입니다(NAS 영구 저장, 200TB).
\begin{lstlisting}[language=bash]
# OK (survives): inside the volume
/lab/yourname/gpu_test.py   ...

# LOST (wiped on restart): inside the container
/root/gpu_test.py        ~/ , anywhere else
\end{lstlisting}
    \footnotesize \alert{규칙:} 중요한 코드·데이터·결과는 \textbf{무조건 \texttt{/lab} 안에}(예: \texttt{/lab/yourname/}) 저장하세요.
\end{frame}

\begin{frame}{공유 폴더 사용 규칙 \alert{(다 같이 쓰는 공간)}}
    \texttt{/lab} 볼륨은 \alert{모두가 공유}합니다. 섞이지 않게 규칙을 지켜주세요.
    \begin{itemize}
        \item 각자 \alert{본인 폴더} 안에서만 작업: \texttt{/lab/본인폴더/}
        \\ \footnotesize (폴더명 규칙은 랩에서 정한 것을 따르세요. 예: 영문 이름)
        \item 공용 데이터셋(예: CIC-DDoS2019)은 \alert{\texttt{/lab/shared/}}에 \textbf{한 번만} 받아 같이 읽기
        \\ \footnotesize (사람마다 중복으로 받지 않기 --- 공간·시간 절약)
        \item 남의 폴더는 \alert{건드리지 않기}
    \end{itemize}
    \vspace{0.4em}
    \begin{block}{우리 랩 폴더 규칙 \footnotesize(2026-06 세미나 안)\normalsize}
        \begin{itemize}
            \item 폴더명: \alert{영문 이름 소문자} (예: \texttt{/lab/sangwan})
            \item 공용 데이터셋: 받기 전 \alert{단톡 공지} $\rightarrow$ \texttt{/lab/shared/}에 저장, \texttt{shared/README.txt}에 한 줄 기록
            \item 공용 venv: \alert{패키지 삭제 금지}, 새로 설치하면 단톡 공지 (버전 충돌 시 개인 venv 권장)
        \end{itemize}
    \end{block}
\end{frame}

\begin{frame}{공유 계정 주의 \alert{(사고 1순위)}}
    우리는 \alert{연구실 대표 계정(\texttt{lab}) 하나를 다 같이} 씁니다. 그래서:
    \begin{itemize}
        \item 같은 워크스페이스에 \alert{여러 명이 동시에} 들어갈 수 있습니다.
        \item 내가 \textbf{Pause/정지}를 누르면 \alert{다른 사람 작업도 같이 꺼집니다.}
        \item 파일도 공용이라, 같은 이름 파일은 \alert{서로 덮어쓸} 수 있습니다.
    \end{itemize}
    \vspace{0.5em}
    \begin{block}{최소 수칙}
        \begin{itemize}
            \item \textbf{Pause 누르기 전에} 다른 사람이 쓰는 중인지 꼭 확인!
            \item 내 파일은 \texttt{/lab/본인폴더/}에 저장 (위 규칙)
        \end{itemize}
    \end{block}
    \footnotesize \alert{우리 랩 규칙 (2026-06 세미나 안):} Pause는 \alert{단톡 공지 $\rightarrow$ 이의 없을 때만} /
    장시간 학습은 \alert{시작 전 단톡 선언}(예상 소요시간 포함) + 돌리기 전 \texttt{nvidia-smi}로 선행 작업 확인 /
    남이 학습 중일 땐 \alert{Pause 금지}.
\end{frame}

\begin{frame}{랩 운영 규칙 — 관리 사항 \footnotesize(2026-06 세미나 안)\normalsize}
    \begin{itemize}
        \item \textbf{워크스페이스가 사라졌을 때}: 재생성은 \alert{관리자 1명이, 지정된 키로만}.
        \\ \footnotesize (생성 시 SSH 키가 한 명 것만 등록되므로, 담당을 안 정하면 그날 모두 막힙니다. 공용 venv 재구축도 담당자 몫 --- 3단계 참고)
        \item \textbf{파일 업로드(SFTP)}: 본인 키로 본인 서버 생성 $\rightarrow$ \alert{유선 교내망}에서 업로드 $\rightarrow$ 끝나면 \alert{Delete} (``파일 옮기기'' 장)
        \item \textbf{청소·백업}: 안 쓰는 대용량 중간산출물은 \alert{학기말 정리}. 중요 결과물은 각자 GitHub 등에 \alert{개인 백업} 권장 (볼륨이 유일한 사본)
        \item \textbf{임대 만료 대비}: \alert{2026년 7월}에 관리 부서에 연장/이전 확인
        \item \textbf{문의 창구 단일화}: 관리 부서 문의는 \alert{관리자를 거쳐 1명}이 (중복 문의 방지)
    \end{itemize}
    \vspace{0.3em}
    \footnotesize 세미나에서 바뀐 내용은 이 장 + 앞 두 장의 규칙 블록만 고치면 됩니다.
\end{frame}

% =========================================================
\section{끝나면 꼭! 정리하기}
% =========================================================

\begin{frame}{작업 끝나면 정지 \alert{(제일 중요)}}
    워크스페이스 상세 화면 위쪽 버튼:
    \begin{itemize}
        \item \textbf{Pause(정지)} --- 작업 잠시 멈춤. \alert{평소엔 이걸 쓰세요.}
        \item \textbf{Delete(삭제)} --- 워크스페이스 자체를 없앰. \alert{함부로 누르지 마세요}(볼륨 파일은 남지만 환경은 초기화).
    \end{itemize}
    \vspace{0.8em}
    \begin{block}{\alert{명심}}
        \alert{브라우저 창만 닫는 건 정지가 아닙니다!} 그리고 공유 계정이라
        \alert{Pause 전에 다른 사람이 쓰는지} 꼭 확인하세요.
    \end{block}
    \footnotesize 반대로 \textbf{본인이 만든 SFTP 서버}는 쓰고 나면 Delete 하는 게 맞습니다(``파일 옮기기'' 장 참고).
\end{frame}

\begin{frame}{쓸 때마다 체크리스트}
    \begin{enumerate}
        \item \alert{교내망}인지 확인 (집에서는 접속 불가)
        \item 시스템 접속 \& 로그인 (보안 경고는 통과)
        \item 워크스페이스 \textbf{이름} 클릭 $\rightarrow$ \textbf{Web Terminal}
        \item (재시작됐으면) \texttt{apt install python3} + \texttt{activate} $\rightarrow$ \texttt{/lab/본인폴더}에서 작업
        \item \alert{끝나면, 다른 사람 확인 후 Pause}
    \end{enumerate}
\end{frame}

\begin{frame}{막혔을 때 / 문의}
    \begin{itemize}
        \item 접속 자체가 안 됨 $\rightarrow$ \alert{교내망}인지 먼저 확인 (집에서는 접속 불가)
        \item \texttt{nvidia-smi}가 안 됨 $\rightarrow$ 워크스페이스가 \texttt{Available}인지 확인
        \item \texttt{python 없음 / torch import 안 됨} $\rightarrow$ \texttt{apt install python3} 후 \texttt{source .../env/bin/activate} (3단계)
        \item 내 파일이 사라짐 $\rightarrow$ \texttt{/lab} 밖에 저장했을 가능성. 다음부턴 \texttt{/lab/본인폴더}에
        \item \alert{파일 업로드(SFTP)가 안 됨} $\rightarrow$ ``파일 옮기기'' 장의 \textbf{올리기 ③} 참고 (\alert{유선 교내망} 필수)
        \item 시스템/계정/망(방화벽) 관련 $\rightarrow$ 학내 관리 부서 \footnotesize(연락처는 공개용에서 마스킹)\normalsize
        \item 그 외 / 이 문서 오류 $\rightarrow$ 작성자에게 문의
    \end{itemize}
\end{frame}

% =========================================================
\section{부록 — 워크스페이스 만들기 (관리자 / 최초 1회)}
% =========================================================

\begin{frame}{부록 안내 --- 대부분은 볼 필요 없습니다}
    \begin{block}{\alert{이 부록이 필요한 경우}}
        워크스페이스를 \alert{처음 만드는 관리자} 또는 \alert{새로 만들어야 할 때}만 보세요.
    \end{block}
    \vspace{0.6em}
    \begin{itemize}
        \item 우리 랩은 \texttt{lab} 계정으로 만든 \textbf{워크스페이스 하나를 공유}합니다.
        \item 이미 워크스페이스가 있으면 \alert{앞의 본론(들어가서 작업하기)}만 보면 됩니다.
        \item 아래는 그 워크스페이스를 \textbf{최초에 만드는} 절차입니다.
    \end{itemize}
\end{frame}

\begin{frame}{[부록] A단계 — 생성 시작 \& 프로젝트}
    \begin{enumerate}
        \item 왼쪽 메뉴 \textbf{Workspaces} $\rightarrow$ 오른쪽 위 \textbf{+ Create}
        \item \textbf{Project} 칸의 \textbf{가져오기} $\rightarrow$ 소속 프로젝트 선택 $\rightarrow$ \textbf{OK}
    \end{enumerate}
    \vspace{0.6em}
    \begin{block}{Workspace 이름 \alert{(규칙 있음!)}}
        \alert{가입 아이디와 똑같이} 입력하세요 (우리 경우 \texttt{lab}). \textbf{중복확인}도 누르세요.
    \end{block}
    \footnotesize \alert{프로젝트 목록이 비어 있으면?} 계정이 프로젝트에 아직 등록 안 된 것. 관리 부서/관리자에게 등록 요청하세요.
\end{frame}

\begin{frame}{[부록] B단계 — 이미지 \& 리소스셋 \alert{(값 주의!)}}
    \begin{enumerate}
        \item \textbf{이미지}: \textbf{가져오기} $\rightarrow$ 프로젝트 선택 $\rightarrow$ \textbf{Ubuntu 22.04} $\rightarrow$ \textbf{OK}
        \\ \footnotesize (현재 선택 가능한 이미지가 22.04뿐입니다)
        \item \textbf{리소스셋}: \textbf{가져오기} $\rightarrow$ 지정된 H100 리소스셋 선택 $\rightarrow$ \textbf{OK}
        \item \textbf{Resource set 개수}: \alert{정확히 \texttt{50}} 입력
    \end{enumerate}
    \vspace{0.5em}
    \begin{block}{\alert{꼭 지킬 것}}
        개수는 \alert{반드시 50}. 다른 값이면 \textbf{컨테이너가 생성되지 않습니다.}
    \end{block}
\end{frame}

\begin{frame}{[부록] C단계 — 볼륨 \& 컨테이너 개수}
    \begin{enumerate}
        \item \textbf{Volume}: \textbf{가져오기} $\rightarrow$ \alert{계정 ID와 같은 볼륨}(\texttt{lab}) 선택 $\rightarrow$ \textbf{OK}
        \item \textbf{Mount path}: \texttt{/lab} 입력
        \item \textbf{Container 개수}: \alert{\texttt{1}} (다른 값이면 생성 불가)
    \end{enumerate}
    \vspace{0.6em}
    \begin{block}{볼륨이 뭐죠?}
        작업 파일이 저장되는 \textbf{영구 저장공간}(NAS 200TB). 컨테이너가 초기화돼도 여기 데이터는 남습니다.
    \end{block}
\end{frame}

\begin{frame}[fragile]{[부록] D단계 — SSH 공개키 (생성 시 1회 필수)}
    생성 화면의 \textbf{Public key} 칸은 필수입니다. 본인 PC \textbf{터미널}에서 키를 만들어 붙여넣으세요.
    \vspace{0.3em}

    \textbf{Windows} (명령 프롬프트 \texttt{cmd}):
\begin{lstlisting}[language=bash]
cd %userprofile%
ssh-keygen -t rsa
type .ssh\id_rsa.pub
\end{lstlisting}

    \textbf{macOS / Linux} (터미널):
\begin{lstlisting}[language=bash]
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
\end{lstlisting}
    \footnotesize \texttt{ssh-rsa}로 시작하는 \alert{전체}를 복사해 \textbf{Public key} 칸에 붙여넣고 \textbf{Create} $\rightarrow$ \textbf{OK}.
    공개키는 \alert{생성할 때만} 필요하고, 이후 작업은 Web Terminal로 합니다.
    \\ 같은 키를 \textbf{SFTP 서버 만들 때}(``파일 옮기기'' 장)도 그대로 재사용합니다.
\end{frame}

% =========================================================
\section{자주 쓰는 리눅스 명령어}
% =========================================================

\begin{frame}[fragile]{명령어 (1) — 이동 \& 둘러보기}
    터미널에서 ``지금 내가 어디 있고 뭐가 있나''를 보는 명령어입니다.
    \begin{itemize}
        \item \texttt{ls} --- 현재 폴더의 파일/폴더 목록 보기
        \\ \footnotesize \texttt{ls -lh} 하면 크기·날짜까지 (예: \texttt{ls -lh /lab})
        \item \texttt{pwd} --- 지금 내가 있는 위치(경로) 출력
        \item \texttt{cd 경로} --- 그 폴더로 이동 (예: \texttt{cd /lab/본인폴더})
        \\ \footnotesize \texttt{cd ..} 는 한 단계 위로, \texttt{cd \textasciitilde} 는 홈으로
    \end{itemize}
    \vspace{0.4em}
    \begin{block}{팁}
        길 잃으면 \texttt{pwd}로 위치 확인 $\rightarrow$ \texttt{cd /lab/본인폴더}로 돌아오기.
    \end{block}
\end{frame}

\begin{frame}[fragile]{명령어 (2) — 폴더 \& 파일 다루기}
    \begin{itemize}
        \item \texttt{mkdir 이름} --- 새 폴더 만들기 (예: \texttt{mkdir /lab/본인폴더})
        \item \texttt{mv A B} --- A를 B로 이동 또는 이름 변경
        \\ \footnotesize 예: \texttt{mv gpu\_test.py /lab/본인폴더/} (파일 옮기기)
        \item \texttt{cp A B} --- A를 B로 복사 (\texttt{cp -r} 는 폴더째 복사)
        \item \texttt{rm 파일} --- 파일 삭제
        \item \alert{\texttt{rm -rf 폴더}} --- \alert{폴더 통째로 삭제 (되돌릴 수 없음!)}
    \end{itemize}
    \vspace{0.3em}
    \begin{block}{\alert{경고}}
        \texttt{rm -rf}는 \alert{경로를 두 번 확인}하고 쓰세요. 오타 한 번에 \alert{전부 날아갑니다.}
        (특히 \texttt{/lab} 안에서 조심 --- 공용 공간입니다.)
    \end{block}
\end{frame}

\begin{frame}[fragile]{명령어 (3) — 확인 \& 실행}
    \begin{itemize}
        \item \texttt{cat 파일} --- 파일 내용 화면에 출력 (예: \texttt{cat gpu\_test.py})
        \item \texttt{nano 파일} --- 간단 편집기로 파일 열기/수정
        \\ \footnotesize 저장: \texttt{Ctrl+O} $\rightarrow$ Enter, 종료: \texttt{Ctrl+X} (vi보다 쉬움)
        \item \texttt{nvidia-smi} --- GPU 상태/사용량 확인
        \item \texttt{df -h} --- 저장공간 확인 (\texttt{/lab}이 보임)
        \item \texttt{python3 파일.py} --- 파이썬 코드 실행
        \item \texttt{pip list} --- 설치된 파이썬 패키지 목록
    \end{itemize}
    \vspace{0.3em}
    \footnotesize \alert{환경 켜기} \texttt{source /lab/shared/env/bin/activate} --- 작업 전 꼭. \texttt{(env)}가 뜨면 켜진 것.
\end{frame}

\begin{frame}[fragile]{명령어 (4) — SFTP 프롬프트 안에서 (\texttt{sftp>})}
    파일 업로드 중 \texttt{sftp>} 프롬프트에서 쓰는 명령입니다. \alert{\texttt{l}이 붙으면 내 노트북, 안 붙으면 서버.}
    \begin{itemize}
        \item \texttt{lpwd} / \texttt{lls} / \texttt{lcd 경로} --- \textbf{노트북 쪽} 위치 확인 / 목록 / 이동
        \item \texttt{pwd} / \texttt{ls} / \texttt{cd 경로} --- \textbf{서버 쪽} 위치 확인 / 목록 / 이동
        \item \texttt{put 파일} --- 노트북 $\rightarrow$ 서버 업로드 (\texttt{put -r 폴더} 는 폴더째)
        \item \texttt{get 파일} --- 서버 $\rightarrow$ 노트북 다운로드
        \item \texttt{bye} --- 종료
    \end{itemize}
    \vspace{0.4em}
    \begin{block}{팁}
        \texttt{!명령} 처럼 느낌표를 붙이면 노트북 쪽 아무 명령이나 실행됩니다 (예: \texttt{!ls -lh}).
    \end{block}
\end{frame}

\begin{frame}{문서 정보}
    \begin{itemize}
        \item 작성: 이상완 / 기준일: 2026년 6월 (\alert{v2.2 공개용})
        \item v2 변경점: \textbf{``파일 옮기기'' 장 신설} --- \texttt{wget}/\texttt{git} 다운로드 + SFTP 업로드 (실제 업로드까지 검증 완료)
        \item v2.1 변경점: \textbf{랩 운영 규칙 반영} --- 폴더·shared·Pause/GPU 조율·관리 사항 (2026-06 랩 세미나 합의 기준)
        \item v2.2 변경점: \textbf{코드블록 한글 깨짐 수정} --- 코드 안은 영문 placeholder, 한글 설명은 코드 밖으로 (복붙 안전)
        \item 검증 환경: \texttt{AIPub} (쿠버네티스 기반 학내 GPU 클라우드 플랫폼)
        \item 이미지: Ubuntu 22.04 / GPU: NVIDIA H100 80GB HBM3 (CUDA 13.2)
        \item 설치 검증: \texttt{python3} + \texttt{torch 2.12} + \texttt{numpy} (공용 venv)
        \item 파일 전송 검증: Web Terminal \texttt{wget}/\texttt{git} + SFTP 업로드(\alert{유선 교내망} 한정 / 와이파이·개인 공유기 망 차단 확인)
        \item 임대 기간: \alert{\textasciitilde 2026년 8월 말}
        \item \alert{공개용 조치}: 내부 주소·IP·포트·계정명·전화번호·프로젝트/리소스셋 이름은 예시 값으로 마스킹
    \end{itemize}
\end{frame}

\begin{frame}[standout]
    질문은 언제든 환영합니다
\end{frame}

\end{document}
