Skip to content

Commit

Permalink
Merge pull request #70 from jabelic/rls/fix-to-auto-merge-010
Browse files Browse the repository at this point in the history
Rls/fix to auto merge 010
  • Loading branch information
jabelic authored Sep 21, 2022
2 parents 74ef2fa + 3579c53 commit d56790f
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 204 deletions.
3 changes: 0 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DelimitedFiles = "8bb1440f-4735-579b-a4ab-409b98df4dab"
Luxor = "ae8d54c2-7ccd-5906-9d76-62fc9837b5bc"
PackageCompiler = "9b87118b-4619-50d2-8e1e-99f35a4d4d9d"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
Revise = "295af30f-e4ad-537b-8983-00126c2a3abe"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[compat]
BenchmarkTools = "1"
Expand Down
18 changes: 18 additions & 0 deletions init
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

init(){
if [ "$(uname)" = 'Darwin' ] && [ "$SHELL" = "/bin/zsh" ]; then
echo "export JULIA_NUM_THREADS=`sysctl -n hw.logicalcpu`" >> ~/.zshrc
elif [ "$SHELL" = "/bin/bash" ] && [ "$SHELL" = "/bin/zsh" ]; then
echo "export JULIA_NUM_THREADS=`sysctl -n hw.logicalcpu`" >> ~/.bashrc
elif [ "$(expr substr $(uname -s) 1 5)"='Linux' ] && [ "$SHELL" = "/bin/bash" ]; then
THREADS=`fgrep 'processor' /proc/cpuinfo | wc -l`
echo "export JULIA_NUM_THREADS=$THREADS" >> ~/.bashrc
else
echo "Your platform ($(uname -a)) is not supported."
exit 1
fi
julia src/settings.jl -t auto
}

init
2 changes: 2 additions & 0 deletions src/environments.jl
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
JULIA_MULTI_PROCESS = true
L = 1.5
# dev | rls
STAGE = "rls"
11 changes: 8 additions & 3 deletions src/sdistance.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ include("./distance_function.jl")
include("./floodfill.jl")
include("./utils/utils.jl")
include("./environments.jl")

import .DistanceFunction: create_signed_distance_function_multiprocess, create_signed_distance_function, distanceToCurve, create_distance_function, create_distance_function_multiprocess
import .Floodfill: signining_field
import .Utils: is_jordan_curve, interpolation
import CSV, DataFrames, Plots, DelimitedFiles, Luxor, BenchmarkTools, TimerOutputs
using CSV, DataFrames, Plots, DelimitedFiles, Luxor, BenchmarkTools, TimerOutputs
const tmr = TimerOutput()
import CSV, DataFrames, DelimitedFiles, Luxor, BenchmarkTools
using CSV, DataFrames, DelimitedFiles, Luxor, BenchmarkTools
if STAGE == "dev"
import Plots, TimerOutputs
using Plots, TimerOutputs
const tmr = TimerOutput()
end

"""
benchmark用method
Expand Down
15 changes: 10 additions & 5 deletions src/settings.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
#= Sysimage for Developers. Sysimage.so must be written on .gitignore because it is so large file! =#
include("./environments.jl")

using Pkg
Pkg.add("PackageCompiler")
Pkg.add("DelimitedFiles")
Pkg.add("TimerOutputs")
Pkg.add("Test")
Pkg.add("Plots")
using PackageCompiler

PackageCompiler.create_sysimage([:CSV, :DataFrames, :Plots, :Luxor, :BenchmarkTools, :TimerOutputs, :Test]; sysimage_path="Sysimage.so")
if STAGE == "dev"
Pkg.add("PackageCompiler")
Pkg.add("TimerOutputs")
Pkg.add("Plots")
using PackageCompiler
PackageCompiler.create_sysimage([:CSV, :DataFrames, :Plots, :Luxor, :BenchmarkTools, :TimerOutputs, :Test]; sysimage_path="Sysimage.so")
end

# >> You can use packages with 'import and using'
# $ julia -JSysimage.so
113 changes: 0 additions & 113 deletions test/APT.jl

This file was deleted.

54 changes: 0 additions & 54 deletions test/draw.jl

This file was deleted.

55 changes: 29 additions & 26 deletions test/main.jl
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
using DataFrames, CSV
using Profile
include("../src/sdistance.jl") # 必ずダブルクオーテーション
include("../test/draw.jl")
include("../src/SignedDistanceFunction.jl")
include("../src/environments.jl")
include("../test/APT.jl")
import .Draw: parformance_graphs
using .SignedDistanceFunction
using .APT
if STAGE == "dev"
include("../src/sdistance.jl") # 必ずダブルクオーテーション
include("../test/draw.jl")
include("../src/SignedDistanceFunction.jl")
include("../test/APT.jl")
import .Draw: parformance_graphs
using .SignedDistanceFunction
using .APT

# This script run by test.sh

# ====== Debug ======
# p = signedDistance2D("./test/mock_csv_data/interface.csv", parse(Int, ARGS[1]))
# DataFrame(p, :auto) |> CSV.write("./test/result/interface_result_n"*ARGS[1]*".csv", header=false)
# p = signedDistance2D("./test/mock_csv_data/interface.csv", parse(Int, ARGS[1]), "multi")
# DataFrame(p, :auto) |> CSV.write("./test/result/interface_floodfill_result_n"*ARGS[1]*".csv", header=false)
# p = signedDistance2D("./test/mock_csv_data/multiple_curves.csv", parse(Int, ARGS[1]), "multi")
# DataFrame(p, :auto) |> CSV.write("./test/result/multiple_curves_result_n"*ARGS[1]*".csv", header=false)
# This script run by test.sh

# ====== profiling =======
# ====== Debug ======
# p = signedDistance2D("./test/mock_csv_data/interface.csv", parse(Int, ARGS[1]))
# DataFrame(p, :auto) |> CSV.write("./test/result/interface_result_n"*ARGS[1]*".csv", header=false)
# p = signedDistance2D("./test/mock_csv_data/interface.csv", parse(Int, ARGS[1]), "multi")
# DataFrame(p, :auto) |> CSV.write("./test/result/interface_floodfill_result_n"*ARGS[1]*".csv", header=false)
# p = signedDistance2D("./test/mock_csv_data/multiple_curves.csv", parse(Int, ARGS[1]), "multi")
# DataFrame(p, :auto) |> CSV.write("./test/result/multiple_curves_result_n"*ARGS[1]*".csv", header=false)

# @profile signedDistance2D("./test/mock_csv_data/interface.csv",parse(Int, ARGS[1]))
# @profile signedDistance2D("./test/mock_csv_data/interface.csv",parse(Int, ARGS[1]), "multi")
# Profile.print()
# open("prof.txt", "w") do s
# Profile.print(IOContext(s, :displaysize => (24, 500)))
# end
# ====== profiling =======

# ====== memory size =======
p = @allocated signedDistance2D("./test/mock_csv_data/interface.csv", parse(Int, ARGS[1]), "multi")
# p = @allocated signedDistance2D("./test/mock_csv_data/multiple_curves.csv", parse(Int, ARGS[1]), "multi")
println("\nUsed memory size: ",p/(1024*1024), " MB")
# @profile signedDistance2D("./test/mock_csv_data/interface.csv",parse(Int, ARGS[1]))
# @profile signedDistance2D("./test/mock_csv_data/interface.csv",parse(Int, ARGS[1]), "multi")
# Profile.print()
# open("prof.txt", "w") do s
# Profile.print(IOContext(s, :displaysize => (24, 500)))
# end

# ====== memory size =======
p = @allocated signedDistance2D("./test/mock_csv_data/interface.csv", parse(Int, ARGS[1]), "multi")
# p = @allocated signedDistance2D("./test/mock_csv_data/multiple_curves.csv", parse(Int, ARGS[1]), "multi")
println("\nUsed memory size: ",p/(1024*1024), " MB")

end

0 comments on commit d56790f

Please sign in to comment.