首先時解釋一下我要作什麼,我打算用julia進行一些並行計算。node
問題的起源是基於一個文檔,文檔連接在這裏。這裏面介紹了關於並行計算的一些配置方法和使用方法,好比能夠在本地添加一些核心(processor),也能夠添加遠程的核心,這裏面添加核心用的是addprocs
函數。還要一些函數好比@spawn
@spawnat
@fetch
就不細說了,看下文檔便知一二,並且有中文文檔能夠看。ssh
如今我就來講一下如何添加遠程核心,我可以查到的資料有兩個,一個是官方STL,另一個是郵件列表裏的一個問題。ide
文檔是這樣說的:函數
addprocs(machines; tunnel=false, dir=JULIA_HOME, sshflags::Cmd=``) → List of process identifiers Add processes on remote machines via SSH. Requires julia to be installed in the same location on each node, or to be available via a shared file system. machines is a vector of host definitions of the form [user@]host[:port]. A worker is started for each such definition. Keyword arguments: tunnel : if true then SSH tunneling will be used to connect to the worker. dir : specifies the location of the julia binaries on the worker nodes. sshflags : specifies additional ssh options, e.g. sshflags=`-i /home/foo/bar.pem` .
大概是說,要幾個參數,第一個是machines
,它是一個向量;第二個參數是tunnel
,是個布爾值;第個是dir
,它表明julia
命令存放位置的一個字符串,好比/usr/bin
;最後是一些sshflags
,暫時用不到。fetch
因而咱們就能夠用了,首先在終端輸入julia
,ui
addprocs(3)
就添加了三個本地核心。addprocs({"eccstartup@xxx.xxx.xxx.xxx[:port]"},tunnel=true,dir="/usr/bin")
這樣就行了,試試nprocs()
吧,很方便吧?google