Skip to content

Commit

Permalink
Merge pull request #21 from kibaekkim/kkim
Browse files Browse the repository at this point in the history
Implemented functions to query DSP versions
  • Loading branch information
kibaekkim authored Dec 11, 2020
2 parents 0a9bb44 + 7a9b2e7 commit 577090b
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 30 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: Run tests

on: [push, pull_request]
on:
push:
pull_request:
branches:
- master

jobs:
test-github-cpuonly:
Expand Down
59 changes: 32 additions & 27 deletions Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ version = "0.3.0"

[[Compat]]
deps = ["Base64", "Dates", "DelimitedFiles", "Distributed", "InteractiveUtils", "LibGit2", "Libdl", "LinearAlgebra", "Markdown", "Mmap", "Pkg", "Printf", "REPL", "Random", "SHA", "Serialization", "SharedArrays", "Sockets", "SparseArrays", "Statistics", "Test", "UUIDs", "Unicode"]
git-tree-sha1 = "a706ff10f1cd8dab94f59fd09c0e657db8e77ff0"
git-tree-sha1 = "2724ac91f1334c8e5c10565faad5afeafd1bfc89"
uuid = "34da2185-b29b-5c13-b0c7-acf172513d20"
version = "3.23.0"
version = "3.24.0"

[[CompilerSupportLibraries_jll]]
deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"]
Expand All @@ -73,15 +73,15 @@ uuid = "8bb1440f-4735-579b-a4ab-409b98df4dab"

[[DiffResults]]
deps = ["StaticArrays"]
git-tree-sha1 = "da24935df8e0c6cf28de340b958f6aac88eaa0cc"
git-tree-sha1 = "c18e98cba888c6c25d1c3b048e4b3380ca956805"
uuid = "163ba53b-c6d8-5494-b064-1a9d43ac40c5"
version = "1.0.2"
version = "1.0.3"

[[DiffRules]]
deps = ["NaNMath", "Random", "SpecialFunctions"]
git-tree-sha1 = "eb0c34204c8410888844ada5359ac8b96292cfd1"
git-tree-sha1 = "214c3fcac57755cfda163d91c58893a8723f93e9"
uuid = "b552c78f-8df3-52c6-915a-8e097449b14b"
version = "1.0.1"
version = "1.0.2"

[[Distributed]]
deps = ["Random", "Serialization", "Sockets"]
Expand All @@ -95,15 +95,15 @@ version = "0.8.3"

[[ForwardDiff]]
deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "NaNMath", "Random", "SpecialFunctions", "StaticArrays"]
git-tree-sha1 = "1d090099fb82223abc48f7ce176d3f7696ede36d"
git-tree-sha1 = "8de2519a83c6c1c2442c2f481dd9a8364855daf4"
uuid = "f6369f11-7733-5829-9624-2563aa707210"
version = "0.10.12"
version = "0.10.14"

[[HTTP]]
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets"]
git-tree-sha1 = "c7ec02c4c6a039a98a15f955462cd7aea5df4508"
deps = ["Base64", "Dates", "IniFile", "MbedTLS", "Sockets", "URIs"]
git-tree-sha1 = "504ca74f27377a25ebfd63b1f5e6ec3e9fb14690"
uuid = "cd3eb016-35fb-5094-929b-558a96fad6f3"
version = "0.8.19"
version = "0.9.1"

[[IniFile]]
deps = ["Test"]
Expand All @@ -128,9 +128,9 @@ version = "0.21.1"

[[JSONSchema]]
deps = ["HTTP", "JSON", "ZipFile"]
git-tree-sha1 = "a9ecdbc90be216912a2e3e8a8e38dc4c93f0d065"
git-tree-sha1 = "b84ab8139afde82c7c65ba2b792fe12e01dd7307"
uuid = "7d188eb4-7ad8-530c-ae41-71a32a6d4692"
version = "0.3.2"
version = "0.3.3"

[[JuMP]]
deps = ["Calculus", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MathOptInterface", "MutableArithmetics", "NaNMath", "Random", "SparseArrays", "Statistics"]
Expand All @@ -154,9 +154,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"

[[MPI]]
deps = ["Distributed", "DocStringExtensions", "Libdl", "MPICH_jll", "MicrosoftMPI_jll", "OpenMPI_jll", "Pkg", "Random", "Requires", "Serialization", "Sockets"]
git-tree-sha1 = "c39dd4bc91e2054cc22af3ef88878a6c143dbd80"
git-tree-sha1 = "d3aae0fd4d9e1a09c3e2fc728fbe2522ec6d54bc"
uuid = "da04e1cc-30fd-572f-bb4f-1f8673147195"
version = "0.16.0"
version = "0.16.1"

[[MPICH_jll]]
deps = ["CompilerSupportLibraries_jll", "Libdl", "Pkg"]
Expand All @@ -176,9 +176,9 @@ uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"

[[MathOptInterface]]
deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "JSON", "JSONSchema", "LinearAlgebra", "MutableArithmetics", "OrderedCollections", "SparseArrays", "Test", "Unicode"]
git-tree-sha1 = "4fd15565d1811be771e87a877f1e691a005d2b90"
git-tree-sha1 = "c4788b9cb29f8d1508e16419e66a7e617b46192d"
uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee"
version = "0.9.18"
version = "0.9.19"

[[MbedTLS]]
deps = ["Dates", "MbedTLS_jll", "Random", "Sockets"]
Expand Down Expand Up @@ -208,9 +208,9 @@ uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0"
version = "0.2.12"

[[NaNMath]]
git-tree-sha1 = "c84c576296d0e2fbb3fc134d3e09086b3ea617cd"
git-tree-sha1 = "bfe47e760d60b82b66b61d2d44128b62e3a369fb"
uuid = "77ba4419-2d1f-58cd-9bb1-8ffee604a2e3"
version = "0.3.4"
version = "0.3.5"

[[OpenMPI_jll]]
deps = ["Libdl", "Pkg"]
Expand All @@ -237,9 +237,9 @@ version = "0.2.0"

[[Parsers]]
deps = ["Dates"]
git-tree-sha1 = "b417be52e8be24e916e34b3d70ec2da7bdf56a68"
git-tree-sha1 = "6370b5b3cf2ce5a3d2b6f7ab2dc10f374e4d7d2b"
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
version = "1.0.12"
version = "1.0.14"

[[Pkg]]
deps = ["Dates", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "UUIDs"]
Expand All @@ -259,9 +259,9 @@ uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"

[[Requires]]
deps = ["UUIDs"]
git-tree-sha1 = "28faf1c963ca1dc3ec87f166d92982e3c4a1f66d"
git-tree-sha1 = "e05c53ebc86933601d36212a93b39144a2733493"
uuid = "ae029012-a4dd-5104-9daa-d747884805df"
version = "1.1.0"
version = "1.1.1"

[[SHA]]
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
Expand All @@ -282,15 +282,15 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[[SpecialFunctions]]
deps = ["OpenSpecFun_jll"]
git-tree-sha1 = "d8d8b8a9f4119829410ecd706da4cc8594a1e020"
git-tree-sha1 = "7286f31f27e3335cba31c618ac344a35eceac060"
uuid = "276daf66-3868-5448-9aa4-cd146d93841b"
version = "0.10.3"
version = "1.1.0"

[[StaticArrays]]
deps = ["LinearAlgebra", "Random", "Statistics"]
git-tree-sha1 = "da4cf579416c81994afd6322365d00916c79b8ae"
git-tree-sha1 = "9da72ed50e94dbff92036da395275ed114e04d49"
uuid = "90137ffa-7385-5640-81b9-e52037218182"
version = "0.12.5"
version = "1.0.1"

[[Statistics]]
deps = ["LinearAlgebra", "SparseArrays"]
Expand All @@ -312,6 +312,11 @@ git-tree-sha1 = "7c53c35547de1c5b9d46a4797cf6d8253807108c"
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
version = "0.9.5"

[[URIs]]
git-tree-sha1 = "bc331715463c41d601cf8bfd38ca70a490af5c5b"
uuid = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"
version = "1.1.0"

[[UUIDs]]
deps = ["Random", "SHA"]
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "DSPopt"
uuid = "cdb1efd8-3f30-48e6-a1f7-a3d77bf376b8"
authors = ["Kibaek Kim <kimk@anl.gov>"]
version = "0.2.0"
version = "0.2.1"

[deps]
JuMP = "4076af6c-e467-56ae-b986-b466b2749572"
Expand Down
12 changes: 11 additions & 1 deletion src/DSPCInterface.jl
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,10 @@ for (func,rtn) in [(:getNumScenarios, Cint),
(:getWallTime, Cdouble),
(:getPrimalBound, Cdouble),
(:getDualBound, Cdouble),
(:getNumCouplingRows, Cint)]
(:getNumCouplingRows, Cint),
(:getVersionMajor, Cint),
(:getVersionMinor, Cint),
(:getVersionPatch, Cint)]
strfunc = string(func)
@eval begin
function $func(dsp::DSPProblem)
Expand Down Expand Up @@ -225,6 +228,13 @@ function getDualSolution(dsp::DSPProblem, num::Integer)
end
getDualSolution(dsp::DSPProblem) = getDualSolution(dsp, getNumCouplingRows(dsp))

function getVersion(dsp::DSPProblem)
major = getVersionMajor(dsp)
minor = getVersionMinor(dsp)
patch = getVersionPatch(dsp)
return "$(major).$(minor).$(patch)"
end

###############################################################################
# Set functions
###############################################################################
Expand Down
18 changes: 18 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@ const dsp = DSPopt.dspenv
@test dsp.comm_rank == 0
end

@testset "Check DSP versions" begin
major = DSPopt.getVersionMajor(dsp)
minor = DSPopt.getVersionMinor(dsp)
patch = DSPopt.getVersionPatch(dsp)
if major > 1
@test true
elseif major == 1
if minor > 4 || (minor == 4 && patch >= 1)
@test true
else
@test false
end
else
@test false
end
@test DSPopt.getVersion(dsp) == "$(major).$(minor).$(patch)"
end

@testset "Setting options" begin
@testset "param:" begin
DSPopt.setoptions!(Dict(:param => "params.txt"))
Expand Down

2 comments on commit 577090b

@kibaekkim
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/26251

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.1 -m "<description of version>" 577090bc557c63930fd50db1a878d73fb202c622
git push origin v0.2.1

Please sign in to comment.