Cov txheej txheem:

Yuav Ua Li Cas Raspberry Pi SuperComputer!: 9 Kauj Ruam (nrog Duab)
Yuav Ua Li Cas Raspberry Pi SuperComputer!: 9 Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Raspberry Pi SuperComputer!: 9 Kauj Ruam (nrog Duab)

Video: Yuav Ua Li Cas Raspberry Pi SuperComputer!: 9 Kauj Ruam (nrog Duab)
Video: Yuav ua cas es thiaj kawm ntawv tau zoo part#2 2024, Kaum ib hlis
Anonim
Yuav Ua Li Cas Ua Raspberry Pi SuperComputer!
Yuav Ua Li Cas Ua Raspberry Pi SuperComputer!

Los ntawm nws tus kheej Raspberry Pi tsis khav theeb cov yam ntxwv tshwj xeeb. Tab sis nrog cov av pheej yig tus nqi, yuav ob peb ntawm cov no thiab txuas rau lawv siv lawv tau siv ua ke ua ke lub zog tuaj yeem ua rau lub khoos phis tawj qis tus nqi. Muaj ntau qhov zoo tshaj plaws rigs tsim txuas kaum ob ntawm Pi's ua ke. Yog li hauv cov lus qhia no, cia peb tshawb xyuas yuav ua li cas thev naus laus zis nyob tom qab ua ke ua ke thiab ua peb tus kheej Bramble Pi!

Kauj Ruam 1: Saib Daim Video

Image
Image

Kuv kuj tau ua ob ntu video version ntawm qhov haujlwm zoo ib yam. Yog li yog tias koj tsis yog tus nyeem ntawv, ncaws rov qab thiab saib cov vis dis aus! Thov nco ntsoov tias cov vis dis aus siv Raspbian Wheezy. Txawm li cas los xij, cov lus qhia hauv qab no yog rau Raspbian Distro tam sim no, uas yog Jessie thaum lub sijhawm kuv sau qhov no.

Kauj ruam 2: Yam Koj Yuav Tsum Tau

Txhawm rau ua raws nrog txoj haujlwm no, ntawm no yog cov khoom koj yuav xav tau

Nov yog yam koj yuav xav tau:

  1. 2 lossis ntau dua Raspberry Pi's
  2. SD daim npav rau txhua Pi
  3. Fais Fab Cables rau txhua Pi
  4. Powered USB Hub (yeem)
  5. Networking Cables
  6. Hub los yog Router

QHOV TSEEB: ~ $ 100.00

Kauj Ruam 3: Txhim Kho thiab Kho Kho Raspbian

Txhim kho thiab teeb tsa Raspbian
Txhim kho thiab teeb tsa Raspbian
Txhim kho thiab teeb tsa Raspbian
Txhim kho thiab teeb tsa Raspbian

Thaum koj muaj txhua ntu, cov kauj ruam tom ntej yog rub tawm thiab teeb tsa Raspbian OS ntawm ib qho ntawm Raspberry Pi's. Qhov no yuav yog koj tus tswv Pi. Nov yog cov kauj ruam:

  1. Rub tawm Raspbian Duab los ntawm no.
  2. Hlawv Raspbian duab rau txhua SD Card koj muaj rau txhua tus Raspberry Pi.

    1. Yog tias koj muaj Windows, koj tuaj yeem ua raws cov lus qhia no.
    2. Yog tias koj muaj Mac, koj tuaj yeem ua raws cov lus qhia no.
  3. Thaum cov duab raug hlawv rau koj daim npav SD, muab tso rau hauv txhua ntawm Raspberry Pi thiab khau raj nws.
  4. Thaum xub pib, koj yuav tsum pom Rasbperry Pi Desktop. Nyem rau ntawm lub tshuab raj icon nyob rau sab saud sab laug thiab mus rau Nyiam> Raspberry Pi Kev teeb tsa. Nov yog cov kev xaiv peb yuav xav tau teeb tsa
    1. Nthuav Cov Ntaub Ntawv SystemIf xav tau.
    2. Hloov lub hostname rau Pi01
    3. Hloov qhov kev xaiv khau raj rau CLI (Command Line Interface), txij li peb yuav tsis siv lub Desktop Interface tiag tiag.
    4. Clock rau ntawm "Interfaces" tab thiab paub tseeb tias SSH tau qhib.
    5. Nyem rau ntawm "Overclock" tab thiab xaiv "Turbo".
    6. Hloov lub cim xeeb GPU rau 16mb.
    7. Nyem rau ntawm "Localization" tab thiab teeb tsa koj cov keyboard teeb tsa kom haum rau koj lub tebchaws.
    8. Ua tiav qhov kev teeb tsa, thiab rov pib dua koj Pi.

Kauj Ruam 4: Txhim Kho MPICH

Txhim kho MPICH
Txhim kho MPICH
Txhim kho MPICH
Txhim kho MPICH
Txhim kho MPICH
Txhim kho MPICH
Txhim kho MPICH
Txhim kho MPICH

Tseem siv tsuas yog ib tus Pi ua tus tswv, tam sim no peb yuav tsum teeb tsa thawj lub software uas yuav tso cai rau peb siv lub zog ua haujlwm ntawm txhua tus Pi hauv peb lub network. Qhov software ntawd hu ua MPICH, uas yog Kev Tshaj Tawm Xov Tooj Sib Txuas. Nov yog yam koj yuav tsum tau ua los nruab nws:

sudo apt-tau hloov tshiab

mkdir2 ib

cd ~/mpich2

wget

txz | | |-mpich-3.1.tar.gz

sudo mkdir/tsev/rpimpi/

sudo mkdir/tsev/rpimpi/mpi-install

mkdir/tsev/pi/mpi-build

cd/tsev/pi/mpi-build

sudo apt-tau nruab gfortran

sudo /home/pi/mpich2/mpich-3.1/configure -prefix =/tsev/rpimpi/mpi-install

sudo ua

sudo ua kom nruab

nano.bashrc

PATH = $ PATH:/home/rpimpi/mpi-install/bin

sudo rov pib dua

mpiexec -n 1 hostname

Cov lus txib no yuav rub tawm thiab teeb tsa MPICH, ntxiv rau nws ntxiv rau koj li BASHRC boot file. Qhov kawg hais kom ua qhov kev xeem seb nws puas ua haujlwm. Yog tias qhov lus txib kawg rov qab "Pi01", tom qab ntawd koj tau ua txhua yam ua tiav.

Kauj Ruam 5: Txhim Kho MPI4PY

Txhim kho MPI4PY
Txhim kho MPI4PY
Txhim kho MPI4PY
Txhim kho MPI4PY
Txhim kho MPI4PY
Txhim kho MPI4PY

Raws li nws yog, MPICH tuaj yeem ua haujlwm C thiab Fortran cov haujlwm. Tab sis txij li Raspberry Pi muaj Python coding ib puag ncig ua ntej, nws yuav yooj yim rau nruab Python rau MPI tus neeg txhais lus. Nov yog cov lus txib ua qhov no:

sudo aptitude nruab sej-dev

wget

tar -zxf mpi4py -1.3.1

cd mpi4py-1.3.1

nab hab sej setup.py tsim

nab hab sej setup.py nruab

export PYTHONPATH =/tsev/pi/mpi4py-1.3.1

mpiexec -n 5 nab hab sej demo/helloworld.py

Qhov lus txib zaum kawg yuav tsum rov qab tsib lo lus teb. Txhua tus yog cov txheej txheem sib txawv ntawm Pi01 khiav qhov kev pab cuam nab nab "Nyob Zoo Ntiaj Teb" uas peb nyuam qhuav ua.

Kauj ruam 6: Luam theej duab

Luam theej duab
Luam theej duab

Tam sim no peb tau ua tiav kev teeb tsa peb tus tswv Pi, peb yuav tsum luam daim Pi ntawd daim npav SD daim duab rau txhua lwm tus Pi. Nov yog qhov koj tuaj yeem ua li ntawd ntawm Windows:

  1. Coj tus tswv SD Card tawm ntawm Pi thiab ntxig rau hauv koj lub computer.
  2. Siv Win32DiskImager, siv "Nyeem" khawm kom khaws cov ntsiab lus ntawm daim npav SD rau hauv koj lub computer.
  3. Tshem tus tswv SD Card thiab ntxig daim npav SD rau ib qho ntawm lwm tus Pi. Tom qab ntawd siv Win32DiskImager "Sau" xaiv los sau cov duab peb khaws tseg rau hauv SD Card tshiab.
  4. Rov ua cov kauj ruam 3 kom txog thaum koj muaj tus duab qub sau rau txhua daim npav SD.

Kauj Ruam 7: Kho Kho Qhov Tseem Ceeb Raspberry Pi's

Configuring Qhov Tseem Ceeb Raspberry Pi's
Configuring Qhov Tseem Ceeb Raspberry Pi's
Configuring Qhov Tseem Ceeb Raspberry Pi's
Configuring Qhov Tseem Ceeb Raspberry Pi's
Configuring Qhov Tseem Ceeb Raspberry Pi's
Configuring Qhov Tseem Ceeb Raspberry Pi's

Tam sim no peb muaj txhua daim npav SD npaj ua ntej, ntxig rau Master SD Card rov qab rau hauv Master Pi, txuas nws mus rau lub router thiab khau raj rov qab. Tom qab ntawd ntxiv rau Raspberry Pi's, ntxig SD Daim Npav rau txhua tus ntawm lawv, txuas lawv mus rau tib lub router zoo li koj tus tswv Pi, thiab tom qab ntawd khau raj lawv tag nrho. Tsis muaj qhov thib ob Pi xav tau kom muaj cov twj siv hluav taws xob, nas, lossis saib.

Thaum tag nrho Pi's tau qhib, siv peb tus tswv Pi, peb yuav tsum muaj peev xwm tau txais IP chaw nyob ntawm txhua Pi ntawm lub network. Nov yog li cas:

  1. Ua ntej Nruab NMAP

    sudo apt-tau hloov tshiab

    sudo apt-tau nruab nmap

  2. Tom qab ntawd tau txais tus IP tam sim no rau tus tswv Pi

    ifconfig

  3. Tam sim no koj tuaj yeem tshuaj xyuas koj lub routers subnet rau lwm qhov chaw nyob IP IP

    sudo nmap -sn 192.168.1.*

Luam tawm txhua qhov IP chaw nyob uas cuam tshuam rau lwm tus Raspberry Pi's hauv lub network. Peb yuav tuaj yeem siv cov IP ntawd txuas rau txhua tus Pi siv SSH. Dab tsi peb yuav tsum tau ua ua ntej yog hloov pauv txhua tus Pi thib ob mus rau lub npe network tshwj xeeb. Tam sim no lawv tau teeb tsa Pi01. Piv txwv tias yog ib tus thib ob Pi tus IP chaw nyob yog 192.168.0.3, ntawm no yog li cas koj tuaj yeem txuas rau nws thiab hloov nws lub npe:

  1. Tsim kom muaj kev sib txuas SSH

    ssh [email protected]

  2. Khiav raspi-config

    sudo raspi-teeb tsa

  3. Hauv lub interface, nqes mus rau qhov Advanced xaiv, thiab tom qab ntawd xaiv Hostname.
  4. Txog tus tswv tsev, hloov Pi01 mus rau tus lej txuas ntxiv, uas yog Pi02.
  5. Tom qab ntawv tawm ntawm SSH ntu

    tawm

Koj xav rov ua cov kauj ruam no rau txhua tus Pi's ntawm lub network hloov lawv mus rau Pi03, Pi04, thiab lwm yam.

Ntawm koj tus tswv Pi, koj xav tsim cov ntawv tshiab hu ua "machinefile"

nano tshuab ntawv

Thiab hauv nws, koj xav ntaus txhua tus Pi tus IP chaw nyob (suav nrog tus tswv IP chaw nyob) ntawm kab tshiab thiab tom qab ntawd khaws cov ntawv.

Txij ntawm no mus, peb tuaj yeem khiav cov ntawv xeem siv

mpiexec -f machinefile -n 4 hostname

tab sis nws yuav yuam kev tawm hais tias muaj "tus tswv tsev pov thawj qhov tsis ua tiav". Yog li hauv cov kauj ruam tom ntej, cia peb kho qhov ntawd.

Kauj Ruam 8: Txheeb Xyuas Tus Tswv Cuab

Txheeb Xyuas Tus Tswv Cuab
Txheeb Xyuas Tus Tswv Cuab
Txheeb Xyuas Tus Tswv Cuab
Txheeb Xyuas Tus Tswv Cuab
Txheeb Xyuas Tus Tswv Cuab
Txheeb Xyuas Tus Tswv Cuab

Txhawm rau kho nws kom kev sib txuas lus nrog txhua Pi tsis ua rau tus tswv tsev pov thawj qhov tsis ua tiav, peb yuav tsum tsim thiab pauv cov yuam sij rau txhua tus ntawm peb Raspberry Pi's. Ib feem no yuav nyuaj me ntsis, tab sis cia siab tias koj tuaj yeem nyob nrog kuv.

  1. Ntawm Tus Xib Hwb Pi, hauv cov ntawv tais ceev tseg hauv tsev, tsim tus yuam sij tshiab.

    cd ~ ib

    ssh-keygen cov

  2. Nkag mus rau ssh nplaub tshev thiab luam cov ntawv tseem ceeb rau ib daim ntawv tshiab hu ua "pi01"

    cd. hws

    cp id_rsa.pub pi01

  3. Tom ntej no koj xav txuas ntawm SSH rau Pi02 thiab rov ua cov kauj ruam tib yam los tsim Pi02 keyfile

    ssh [email protected]

    ssh-keygen cov

    cd. hws

    cp id_rsa.pub pi02

  4. Ua ntej tawm ntawm Pi02, peb yuav tsum luam theej tawm Pi01 keyfile rau nws thiab tso cai rau nws.

    scp 192.168.1.2:/home/pi/.ssh/pi01.

    miv pi01 >> tso cai_key

    tawm

  5. Nrog Pi02 ua tiav, rov ua txhua yam ntawm cov kauj ruam no rau Pi03

    ssh [email protected]

    ssh-keygen cov

    cd. hws

    cp id_rsa.pub pi03

    scp 192.168.1.2:/home/pi/.ssh/pi01.

    miv pi01 >> tso cai_key

    tawm

  6. Rov ua cov kauj ruam kawg rau qhov Pi uas tseem tshuav uas koj muaj hauv koj lub network.
  7. Tom qab tsim cov yuam sij rau txhua tus Pi's, tawm rov qab mus rau koj tus tswv Pi thiab luam tawm tag nrho cov yuam sij tau tsim ntawm txhua tus Pi's.

    cp 192.168.1.3:/home/pi/.ssh/pi02

    miv pi02 >> tso cai_key

    cp 192.168.1.4:/home/pi/.ssh/pi03

    miv pi03 >> tso cai_key

    cp 192.168.1.5:/home/pi/.ssh/pi02

    miv pi04 >> tso cai_key

  8. (rov ua ntau npaum li Pi's nyob hauv koj lub network)

Kauj Ruam 9: Khiav Txoj Haujlwm ntawm Koj Lub Supercomputer

Khiav ib qhov program ntawm koj lub Supercomputer
Khiav ib qhov program ntawm koj lub Supercomputer
Khiav ib qhov program ntawm koj lub Supercomputer
Khiav ib qhov program ntawm koj lub Supercomputer
Khiav ib qhov program ntawm koj lub Supercomputer
Khiav ib qhov program ntawm koj lub Supercomputer

Tam sim no txhua yam yuav tsum teeb tsa. Thaum tseem nyob ntawm koj tus Xib Hwb Pi, sim khiav lub tshuab ntawv no dua:

cd ~ ib

mpiexec -f machinefile -n 4 hostname

Yog tias txhua yam tau ua tiav raug, nws yuav tsum xa tus IP chaw nyob ntawm txhua yam koj li Raspberry Pi. Tam sim no peb tau ua tiav qhov kev sim tawm peb lub supercomputer, cia khiav ib qhov kev pab cuam nab nab rau nws:

  1. Rub tawm thiab unzip kuv qhov kev xeem Python lo lus zais tawg tsab ntawv.

    wget

    tar -zxf python_test.tar.gz

  2. Kho tus password hash rau ib qho uas koj xav tawg.

    nano python_test/md5_attack.py

  3. Luam theej sej cov ntaub ntawv rau txhua tus ntawm koj li Pi.

    scp -r python_test 192.168.1.3:/home/pi

    scp -r python_test 192.168.1.4:/home/pi

    scp -r python_test 192.168.1.5:/home/pi

  4. (rov hais dua rau txhua qhov Pi uas tseem tshuav)
  5. Khiav tus nab hab sej tsab ntawv.

    mpiexec -f machinefile -n 5 python python_test/md5_attack.py

Tsab ntawv yuav khiav siv lub zog ua haujlwm ntawm txhua tus Pi hauv koj lub network! Xav tias dawb los sim nws siv koj tus kheej cov ntawv nab hab sej!

Raspberry Pi Contest 2016
Raspberry Pi Contest 2016
Raspberry Pi Contest 2016
Raspberry Pi Contest 2016

Qhov khoom plig thib peb hauv Raspberry Pi Contest 2016

Pom zoo: