Skip to content

Commit

Permalink
sample files
Browse files Browse the repository at this point in the history
  • Loading branch information
Akaike Ryoko committed Oct 8, 2019
0 parents commit 764c55b
Show file tree
Hide file tree
Showing 212 changed files with 54,837 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$ sudo apt update
$ sudo apt -y install build-essential

$ wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.2.0-linux-x86_64.tar.gz
$ tar xvfz julia-1.2.0-linux-x86_64.tar.gz
$ sudo ln -s /home/ubuntu/julia-1.2.0/bin/julia /usr/local/bin/julia
4 changes: 4 additions & 0 deletions Chapter01/02. JuliaをIDEで使う/SublimeText.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"cmd": ["ConEmu64", "/cmd", "julia -i", "$file"],
"selector": "source.julia"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$ wget -P ~/ https://raw.githubusercontent.com/Naereen/nanorc/master/julia.nanorc
$ echo include \"~/julia.nanorc\" >> ~/.nanorc


git clone git://github.com/JuliaEditorSupport/julia-vim.git
mkdir -p ~/.vim
cp -R julia-vim/* ~/.vim


wget -P ~/julia-emacs/ https://raw.githubusercontent.com/JuliaEditorSupport/julia-emacs/master/julia-mode.el
echo "(add-to-list 'load-path \"~/julia-emacs\")" >> ~/.emacs
echo "(require 'julia-mode)" >> ~/.emacs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
$ sudo apt update
$ sudo apt install --yes build-essential python-minimal gfortran m4 cmake pkg-config libssl-dev


$ git clone git://github.com/JuliaLang/julia.git
$ cd julia
$ git checkout v1.2.0

$ make -j $((`nproc`-1)) 1>build_log.txt 2>build_error.txt


$ cd ~
# Get link from MKL website
$ wget http://registrationcenter-download.intel.com/[go to Intel MKL web site to get link]/l_mkl_2019.0.117.tgz
$ tar zxvf l_mkl_2019.0.117.tgz
$ cd l_mkl_2019.0.117
$ sudo bash install.sh

cd ~/julia
echo "USEICC = 0" >> Make.user
echo "USEIFC = 0" >> Make.user
echo "USE_INTEL_MKL = 1" >> Make.user
echo "USE_INTEL_LIBM = 0" >> Make.user
source /opt/intel/bin/compilervars.sh intel64
make -j $((`nproc`-1)) 1>build_log.txt 2>build_error.txt


$ cd ~
# Get the link from Intel C++ compilers website
$ wget http://[go to Intel to get link]/parallel_studio_xe_2018_update3_professional_edition.tgz
$ tar zxvf parallel_studio_xe_2018_update3_professional_edition.tgz
$ cd parallel_studio_xe_2018_update3_professional_edition
$ sudo bash install.sh

cd ~/julia
echo "USEICC = 0" >> Make.user
echo "USEIFC = 0" >> Make.user
echo "USE_INTEL_MKL = 1" >> Make.user
echo "USE_INTEL_LIBM = 1" >> Make.user
source /opt/intel/bin/compilervars.sh intel64
make -j $((`nproc`-1)) 1>build_log.txt 2>build_error.txt


$ sudo ln -s /home/ubuntu/julia/usr/bin/julia /usr/local/bin/julia
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"cmd" : ["julia", "$file", "$args"],
"info" : "Started $project_path$file_name",
"selector" : "source.jl"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$ julia -i hello.jl Al Bo Cyd
$ julia -e "println(factorial(10))"
$ julia --banner=no


julia> RandomDevice()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
println("Hello " * join(ARGS, ", "))
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
using Random

ENV["JULIA_EDITOR"] = "vim"

println("Setup successful")
40 changes: 40 additions & 0 deletions Chapter01/07. Juliaをマルチコアで使う/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
$ julia --banner=no -p 2


julia> using Distributed
julia> nworkers()
julia> exit()


$ julia --banner=no -p auto -L hello.jl


julia> exit()


$ julia --banner=no -p auto -L hello2.jl


julia> exit()


# Linux bash
$ export JULIA_NUM_THREADS=`nproc`
$ julia -e "println(Threads.nthreads())"


# Windows cmd
C:\> set JULIA_NUM_THREADS=%NUMBER_OF_PROCESSORS%
C:\> julia -e "println(Threads.nthreads())"


D:\> julia --banner=no -p 2 -L hello2.jl


julia> pwd()
julia> using Distributed
julia> pmap(i -> (i, myid(), pwd()), 1:nworkers())
julia> cd("C:\\")
julia> pwd()
julia> addprocs(2)
julia> pmap(i -> (i,myid(),pwd()), 1:nworkers())
1 change: 1 addition & 0 deletions Chapter01/07. Juliaをマルチコアで使う/hello.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
println("Hello " * join(ARGS, ", "))
2 changes: 2 additions & 0 deletions Chapter01/07. Juliaをマルチコアで使う/hello2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
println("Hello " * join(ARGS, ", "))
sleep(1)
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
julia> x = 10 # 単なるテスト
julia> @edit sin(1.0)
julia> ;


# Linux bash
shell> ls

# Windows cmd
shell> dir


julia> include("example.jl")
julia> ?
help?> include
julia> <CTRL-R>
(reverse-i-search)`x =': x = 10
julia> x = 10
julia> exit()
julia> @which sin(1.0)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
println("An example was run!")
10 changes: 10 additions & 0 deletions Chapter01/09. Juliaで計算結果を表示する/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
julia> using Pkg; Pkg.add("PyPlot")
julia> include("display.jl")


$ julia display.jl
$ julia display2.jl


julia> transpose(1:100)
julia> rand(100, 100);
12 changes: 12 additions & 0 deletions Chapter01/09. Juliaで計算結果を表示する/display.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using PyPlot, Random

function f()
Random.seed!(1)
r = rand(50)
@show sum(r)
display(transpose(r))
print(transpose(r))
plot(r)
end

f()
14 changes: 14 additions & 0 deletions Chapter01/09. Juliaで計算結果を表示する/display2.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using PyPlot, Random

function f()
Random.seed!(1)
r = rand(50)
@show sum(r)
display(transpose(r))
print(transpose(r))
plot(r)
show()
end

f()

14 changes: 14 additions & 0 deletions Chapter01/10. パッケージの管理/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
julia> ]
(v1.0) pkg> status
(v1.0) pkg> add BenchmarkTools
(v1.0) pkg> status
(v1.0) pkg> precompile


julia> using BenchmarkTools
julia> @btime rand()

julia> ]
(v1.0) pkg> add [email protected]
(v1.0) pkg> pin BSON
(v1.0) pkg> free BSON
16 changes: 16 additions & 0 deletions Chapter01/11. JuliaをJupyter Notebookで使う/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
julia> ]
(v1.2) pkg> add IJulia

julia> using IJulia
julia> notebook()


$ ~/.julia/packages/Conda/hsaaN/deps/usr/bin/jupyter notebook


C:\> %userprofile%\.julia\packages\Conda\hsaaN\deps\usr\Scripts\jupyter-notebook


ENV["JUPYTER"] = "[path to your jupyter program]"
using Pkg
Pkg.build("IJulia")
21 changes: 21 additions & 0 deletions Chapter01/12. JuliaをJupyterLabで使う/commands.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
julia> ]
(v1.2) pkg> add Conda

julia> using Conda
julia> Conda.add("jupyterlab")


$ ~/.julia/packages/Conda/hsaaN/deps/usr/bin/jupyter lab


C:\> %userprofile%\.julia\packages\Conda\hsaaN\deps\usr\Scripts\jupyter-lab


$ wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh

$ sudo bash Anaconda3-5.3.0-Linux-x86_64.sh

$ /home/ubuntu/anaconda3/bin/jupyter lab


C:\> C:\ProgramData\Anaconda3\Scripts\jupyter-lab.exe
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$ chmod 400 keyfile.pem


$ ssh -i path/to/keyfile.pem -L8888:127.0.0.1:8888 ubuntu@[enter_hostname_here]

$ ~/.julia/packages/Conda/hsaaN/deps/usr/bin/jupyter lab

C:\> %userprofile%\.julia\packages\Conda\hsaaN\deps\usr\Scripts\jupyter-lab


julia> using IJulia
julia> notebook(detached=true)
julia> run(`$(IJulia.notebook_cmd[1]) notebook list`)
Loading

0 comments on commit 764c55b

Please sign in to comment.