1 / 19

Using “Number Machines” at DAM, NUK

Using “Number Machines” at DAM, NUK. 國立高雄大學應用數學系 2006 年 10 月 20 日. What are the ‘”number machine”? How to log in the “number machine”? How to upload/download files? How to edit C/C++ codes?. How to compile source codes? How to run execution files? Basic Linux command How to use VNC?.

monte
Download Presentation

Using “Number Machines” at DAM, NUK

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Using “Number Machines” at DAM, NUK 國立高雄大學應用數學系 2006年10月20日

  2. What are the ‘”number machine”? How to log in the “number machine”? How to upload/download files? How to edit C/C++ codes? How to compile source codes? How to run execution files? Basic Linux command How to use VNC? Outline

  3. What are the ”number machine”?

  4. What are the ”number machine”?

  5. How to log in the “number machine”?

  6. How to upload/download files to/from the “number machine”?

  7. Set environment parameters • Edit your ”.bash” file in the home directory# .bashrc# User specific aliases and functions # Source global definitionsif [ -f /etc/bashrc ]; then . /etc/bashrcfisource /APSoft/env9.sh

  8. How to compile and run program? • Fortran • Edit (hello.f90)Program Helloimplicit nonewrite(*,*) ‘Hello, World.’end • Compile> ifort hello.f90 • Run> ./a.out

  9. program gall_gesv use la_precision, only: wp => dp use f95_lapack, only: la_gesv ! --------------- ! local variables ! --------------- implicit none character (len=*), parameter:: fmt='(7(1x,f9.3))' integer :: ii, jj, ndim, nrhs real(wp), allocatable :: mtx_A(:,:), mtx_B(:,:) ! -------------- ! initialization ! -------------- ndim = 5 nrhs = 2 allocate(mtx_A(ndim,ndim), mtx_B(ndim, nrhs)) How to call library from Fortran? • LAPACK • Edit (call_gesv.f90)

  10. How to call library from Fortran? ! ---------------------------- ! output the computed solution ! ---------------------------- write(*,*) 'Matrix A:' do jj=1,ndim write(*,fmt) mtx_A(:,jj) end do write(*,*) 'Matrix B:' do jj=1,nrhs write(*,fmt) mtx_B(:,jj) end do write(*,*) 'The solution:' do jj=1,nrhs write(*,fmt) mtx_B(:,jj) end do end program gall_gesv ! ----------------------- ! define the problem Ax=B ! ----------------------- ! --- define matrix A do ii=1,ndim do jj=1,ndim mtx_A(ii,jj)=real(ii,wp)**real(jj,wp) end do end do ! --- define matrix B do jj=1,nrhs mtx_B(:,jj) = sum(mtx_A, dim=2)*jj end do ! ------------------------------- ! solve the linear system by gesv ! ------------------------------- call la_gesv(mtx_A, mtx_B)

  11. Make (compile and link) • Run the program

  12. How to edit codes? • Emacs 啟動: • [b45_chad@umath b45_chad]$emacs <==輸入"emacs"開啟!!! • 一些基本指令: 結束Emacs: Ctrl-x Ctrl-c 取消執行 : Ctrl-g • 開啟新檔案: Ctrl-x Ctrl-f 輸入檔名,例如:hello.c • 刪除游標目前指的/後面的字 Ctrl-d • 存檔:Ctrl-s

  13. How to compile and run program? C: Last login: Wed Feb 23 2005 13:19:24 +0800 from 140.127.223.114 No mail. [b45_chad@umath b45_chad]$ gcc hello.c –o hello [b45_chad@umath b45_chad]$ ./hello Hello!! [b45_chad@umath b45_chad]$ C++: Last login: Wed Feb 23 2005 13:19:24 +0800 from 140.127.223.114 No mail. [b45_chad@umath b45_chad]$ g++ hello.cpp –o hello [b45_chad@umath b45_chad]$ ./hello Hello!! [b45_chad@umath b45_chad]$

  14. How to invoke Matlab? • 圖形介面: > matlab • 文字模式 (no java virtual machine):> matlab –nojvm

  15. Basic Linux command • 顯示目前的目錄:pwd • 分頁顯示:less (路徑) ex: less hello.c • 更改密碼:passwd • 變換目錄:cd ex:cd math (到math這個目錄) • 到根目錄:cd / • 建立一個新目錄:mkdir ex:mkdir math (建立math這個目錄) • 刪除一個空目錄:rmdir ex:rmdir math (刪除math這個目錄)

  16. Basic Linux command • 列出資料夾檔案:ls [-ailS] ex: ls -a • 參數說明: -a :全部的檔案都列出(連同隱藏檔) -i :印出inode 的值 -l :長的列出,連同檔案大小的資料等等 -s :以檔案大小排序 • 複製檔案:cp [來源檔] [目的地] ex: cp hello.c math (複製hello.c到math資料夾) • 刪除檔案:rm [檔名] ex: rm hello.c (刪除hello.c)

  17. VNC (Virtual Network Computing) • VNC 可將遠端平台的畫面顯示至本地端,並可遙控操作。 • 遠端與本地端的平台作業系統無須相同,Linux, Windows,...等皆可。 • 參考網址: • http://www.uk.research.att.com/vnc/ • http://www.realvnc.org/ • http://www.vnc.org/

  18. VNC • 伺服器端 (zero.math.nuk.edu.tw) > vncserver :2 啟動 port 5802 上的 vnc server > vncpasswd 設定 vnc server 密碼 > vncserver -kill :2 關閉 port 5802 上的 vnc server • 本機端 (Windows) • Method 1: 利用瀏覽器連結 5802 port 上的 vnc server 網址為 http://zero.math.nuk.edu.tw:5802 • Method 2: 利用 vnc viewer 連結 5802 port 上的 vnc server 開啟 vnc viewer 後填入 zero.math.nuk.edu.tw:2

  19. VNC • 注意事項 • 使用完後,務必在伺服器端將 vnc server 關閉。 (指令為: vncserver -kill :2) • 若某個 port 被使用,請嘗試其他的 port。 port 可選取範圍為 1-60 (5801-5860)。 • 依學號末位決定登入主機 。 • 在 101 室時 port 的選擇等同於該電腦的順序。計算方法如下: i-j 號電腦的順序數為 (i-1)*6 + j例如:第 3-5 號電腦的順序數為 (3-1)*6 + 5 = 17

More Related