วันพฤหัสบดีที่ 2 มิถุนายน พ.ศ. 2559

การติดตั้ง SuiteSparse (How to install SuiteSparse on ubuntu)

บททความนี้เป็นการติดตั้ง SuiteSparse บน ubuntu

1. sudo apt-get install cmake
    #Install cmake

2. sudo apt-get upgrade
   #Upgrade system after install cmake

3. http://faculty.cse.tamu.edu/davis/SuiteSparse/
    #Download suitesparse

4. sudo tar xvzf SuiteSparse-4.5.3.tar.gz
    #Extract tarball

5. cd SuiteSparse

6. cd SuiteSparse_config

7. sudo cp SuiteSparse_config.mk SuiteSparse_config.mk.back
    #Copy  SuiteSparse_config.mk file  to SuiteSparse_config.mk.back

8. sudo nano SuiteSparse_config.mk
    #Edit SuiteSparse_config.mk file

9. INSTALL_LIB = /home/deepman/SuiteSparse/lib
    #Edit line INSTALL_LIB
    #You wrote path for copy file to /SuiteSparse/lib floder

10. INSTALL_INCLUDE = /home/sam/local/include
      #Edit line INSTALL_INCLUDE
      #You wrote path for copy file to /SuiteSparse/include floder

11. CHOLMOD_CONFIG = -DNPARTITION
     #Edit line CHOLMOD_CONFIG
     #You wrote "-DNPARTITION" behind CHOLMOD_CONFIG =

12. sudo make

13. cd UMFPACK

14. sudo make library

15. sudo make install

16. cd ../AMD

17. sudo make install

18. cd ../SuiteSparse_config

การติดตั้ง ATLAS (How to install ATLAS on ubuntu)

บทความนี้เป็นการติดตั้ง ATLAS บน Ubuntu นะครับ เริ่มกันเลยนะครับ

1. sudo apt-get install build-essential python-dev swig gfortran python-nose
    #Install packages

2. sudo apt-get install cpufrequtils
    #Install packages

3. sudo apt-get install gnome-applets
    #Install packages

4. sudo cpufreq-selector -g performance
    #ATLAS’ timing algorithm require CPU throttling to be disabled.
    #This disables it on the 0th core

5. sudo cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
    sudo cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
    sudo cp /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
    #Then disable it on each additional core. For a quad core processor, these commands will be required

6. sudo tar -xvf atlas3.10.2.tar.bz2
    #Extract tar ball

7. cd ATLAS

8. sudo mkdir Linux
    #Create directory build

9. cd Linux

10. sudo ../configure -b 64 -Fa alg -fPIC --with-netlib-lapack-tarfile=/home/deepman/Tar/lapack-3.6.0.tgz --prefix=/home/deepman/ATLAS
      # --with-netlib-lapack-tarfile=/home/deepman/Tar/lapack-3.6.0.tgz
      #เป็น path ที่เก็บ lapack-3.6.0.tgz
      # --prefix=/home/deepman/ATLAS
      #เป็น path ที่เราติดตั้ง atlas

11. sudo make
 
12. cd lib

13. sudo make shared

14. sudo make ptshared

การติดตั้ง Openblas (How to install openblas on ubuntu)

บทความนี้เป็นการติดตั้ง openblas ซึ่งเจ้าตัว openblas นั้นเป็นไลบารี่ตัวหนึ่งของ blas (ถ้าแปลไม่ผิดนะครับ ^^) เรามาดูการติดตั้งกันเลยดีกว่านะครับ

1. sudo apt-get install libopenblas-base
    #Install libopenblas-base Library

2. sudo apt-get install libopenblas-dev
    #Install libopenblas-dev  Library

3. sudo git clone https://github.com/xianyi/OpenBLAS.git
#Download Openblas by github

4. sudo tar -xvf Openblas-0.2.18.tar.gz
#Extract tar ball openblas

5. cd openblas

6. sudo make FC=gfortran
#Install Openblas

7. sudo make PREFIX=/opt/OpenBLAS install
  #Install to Directory 

8. sudo make 
    #Normal compile: Detect CPU

9. sudo make PREFIX=/opt/OpenBLAS install
    #Install to Directory 

10. sudo make DEBUG=1
      #Debug Version

11. sudo sudo make PREFIX=/opt/OpenBLAS install
      # #Install to Directory 

Notice:

การติดตั้ง Scipy (How to install scipy on ubuntu)

บทความนี้เป็นการติดตั้ง scipy ซึ่งเป็น python package อีกตัวหนึ่งที่ใช้ในด้านงานวิทยาศาสตร์นะครับ เรามาดูขั้นตอนการติดตั้งกันเลยดีกว่านะครับ

1. git clone git://github.com/scipy/scipy.git scipy
    #Download scipy by git command
    #you have to install git command before you use git clone git .............

2. sudo apt-get install python-pip
    #Install pip python package

3. pip install -U Sphinx
    #Install Sphinx

4. pip install --upgrade pip
    #Upgrade pip

5. Download Cython
    #http://cython.org/#download

6. sudo tar xvzf Cython-0.24.tar.gz
    #Extract tarball cython file

7. cd Cython-0.24

8. python setup.py install
    #Install Cython

9. cd /home/deepman/scipy
    #Go to scipy directory

10. sudo apt-get install python-dev
      #Install python package

11. sudo git clean -xdf

12. sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

13. sudo python setup.py install --user
      #Install scipy

14. sudo python setup.py build_sphinx
     #Build documentation

15. sudo apt-get install ninja-ide
      #Install IDE python

16. cd ..

17. https://pypi.python.org/pypi/nose/
      #Download nose python package

18. sudo tar xvzf nose-1.3.7
      #Extract tarball

20. cd nose

21. sudo python setup.py install
      #Install nose

22. Open ninja-ide

23. Type code: 
                         import scipy
                         scipy.test()
                         scipy.test('full')

24. run code 

25. cd /home/deepman/

26. https://www.continuum.io/downloads
      #Download Anaconda 64 bit

27. bash Anaconda3-4.0.0-Linux-x86_64.sh
      #Install Anaconda 64 bit

28. After installed Anaconda, you have close and open terminal again

29. conda update conda
      #conda update command

30. Proceed ([y]/n)? y
      #If a newer version of conda is available, type Y to update

Notice:
How to install everything, you can read from readme file or install file in directory program. 

การติดตั้ง numpy (How to install numpy on ubuntu)

บทความนี้เป็นการติดตั้ง numpy ผมขอกล่าวคล่าว ๆ นะครับ numpy เป็น package ของ python ตัวหนึ่งซึ่งเกี่ยวกับการประมวลทางวิทยาศาสตร์ เริ่มกันเลยนะครับ ซึ่งการติดตั้งเราใช้ command line เป็นหลักนะครับ

1. git clone git://github.com/numpy/numpy.git numpy
    #Download numpy by git command
    #ถ้าผมจำไม่ผิดคำสั่ง git นั้นเราต้องติดตั้งเพิ่มนะครับ ซึ่งตัว Ubuntu จะบอกเราเอง ^^'

2. python -V
    #Show version python
    # Ubunu ที่ผมติดตั้งเป็น verion 16.04 ซึ่ง python ที่มากับระบบคือ 2.7 (ถ้าจำไม่ผิด)

3. sudo apt-get install python-setuptools
    #Install python module setuptool

4. sudo python setup.py build -j 4 install --prefix $HOME/.local
    #Install numpy run

5. sudo python setup.py build_ext --inplace -j 4
    #It is buiild python, The number of build jobs can also be specified via the environment variable
    #NPY_NUM_BUILD_JOBS

6. sudo cp site.cfg.example  site.cfg
    #Copy config file from site.cfg.example to site.cfg

7. sudo python runtests.py
    #Test numpy

Notice:
How to install everything, you can read from readme file or install file in directory program.

การติดตั้ง LAPACK (How to install LAPACK on ubuntu)

บทความนี้เป็นการติดตั้ง LAPACK ซึ่งเป็นโปรแกรม หรือ โมดูลหนึ่งที่ใช้ในการพัฒนา deep learning โดยที่ LAPACK ได้ถูกพัฒนาขึ้นจากภาษาฟอร์แทน  และ LAPACK ทำให้หน้าที่ในแก้ไขปัญหาต่าง ๆ ในรูปแบบการจำลองระบบขึ้นมาทำงานโดยจะใช้ linear equations, least-squares solutions of linear systems of equations, eigenvalue problems ในการจัดการ  

ก่อนการติดตั้งตัว LAPACK ขออธิบายก่อนนะครับว่าระบบปฏิบัติที่เราใช้เป็น UBUNTU Linux ในการติดตั้งตัว LAPACK ดังนั้นคำสั่งต่าง ๆ เราจะอิงจาก UBUNTU เป็นหลักนะครับ งั้นเรามาเริ่มกันเลยนะครับ


1. sudo wget http://www.netlib.org/lapack/lapack-3.6.0.tgz
    # Download lapack  file โดยผ่าน command line
    #ในการ download lapack file เราสามารถ download ได้โดยผ่านทาง web site: http://www.netlib.org/lapack/lapack-3.6.0.tgz (ขณะที่ผมทำการติดตั้งนั้น version ล่าสุดคือ 3.6.0)

2. sudo tar -xvzf lapack-3.6.0.tgz
    #เป็นการแตก lapack file

3. cd lapack
    #เข้าไปใน folder lapack ที่เราได้แตกไฟล์ออกมา

4. cp make.inc.example make.inc
    #Copy config file from make.inc.example to make.inc

5. sudo make blaslib   
    #Install blaslib

6. sudo make blas_testing 
    #Testing blas after install blaslib

7. sudo make lapack_install
    #Install lapack

8. sudo make lapacklib 
    #Create lapack library

9. sudo make tmglib
    #Install and Create the Test Matrix and generator Library

10. ulimit -s 65000
      #เป็นคำสั่งที่ต้องใส่เพราะไม่งั้น Err เวลาสั่ง make ในขั้นตอนต่อไป

11. sudo make lapack_testing 
      #Test lapack

12. cd TESTING/LIN

13. sudo make
      #Execute files 

14. cd LAPACK/TEST

15. sudo make

16. cd ..

17. sudo make

หมายเหตุ
1. make              #เป็นเหมือนคำสั่งในการ install 
2. make clean    #เป็นเหมือนคำสั่งในการ  delete
3. How to install everything, you can read from readme file or install file in directory program.

Website
File setup: http://www.netlib.org/lapack/index.html
How to setup: http://www.netlib.org/lapack/lawn81/node1.html


การติดตั้ง BLAS (How to install BLAS on ubuntu)

หายไป 1 - 2 วันไม่ได้อยากจะอู้งานอะไรเลยนะครับเพียงแค่เร่งงานที่รับผิดชอบให้มันก้าวหน้ามากขึ้นกว่าเดิมวันนี้เลยเร่งเขียนให้มากหน่อยเพื่อทุนเอาไว้ก่อน ^^

วันนี้เราอธิบายการติดตั้ง BLAS แบบบ้าน ๆ กันนะครับ ซึ่งผมไม่ได้มีหลักการอะไรเลยครับ ^^  เจ้าตัว BLAS นั้นป็น module หนึ่งที่ใช้ในการจัดการเกี่ยวกับ  vector และ matrix ซึ่งต้องใช้ใน deep learning ด้วยนะครับ 

โดยระบบปฏิบัติการที่เราใช้ในการติดตั้ง module ต่าง ๆ เราใช้ตัว Ubuntu เป็นหลักในการทำงานนะครับ ดังนั้นคำสั่งต่าง ๆ ขออ้างอิงตัว Ubuntu เป็นหลักนะครับ งั้นเราเริ่มกันเลยดีกว่านะครับ

1. ติดตั้ง Library ซึ่งจะมีดังนี้
    1.1.sudo apt-get install python-dev
    1.2.sudo apt-get install cython
    1.3.sudo apt-get install gfortran

2.Download  http://www.netlib.org/blas/blas.tgz

3. sudo tar -xvzf  blas-3.6.0.tgz
   #เป็นการแตกไฟล์ blas

4. cd BLAS
    #เข้าไปใน Directory blas

5. f77 -c -O3 *.f
    #compile file ทั้งที่ลงท้ายด้วย f และโปรดิวส์ไฟล์ที่นามสกุล .o

6. ar rv libblas.a *.o
    #คอมไฟล์นามสกุล .o ใน library

7. su -c "cp libblas.a /usr/local/lib"
    #เปลี่ยน user เป็น root

หมายเหตุ
How to install everything, you can read from readme file or install file in directory program.

อ้างอิงในการ download: http://www.netlib.org/blas/#_software