Skip to content

Commit

Permalink
Merge bbecb19 into 2bc2e18
Browse files Browse the repository at this point in the history
  • Loading branch information
dpo committed May 9, 2020
2 parents 2bc2e18 + bbecb19 commit 6c50cd2
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 25 deletions.
6 changes: 6 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[sifcollection]
git-tree-sha1 = "a7ea0d0aaf29a39ca0fe75588fc077cdd5b5ed54"

[[sifcollection.download]]
url = "https://bitbucket.org/optrove/sif/get/99c5b38e7d03.tar.gz"
sha256 = "33b29e46288c6f019f4ee58e0df6b2797bc2642419b2c181edc574c8db8f6f34"
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NLPModels = "a4795742-8479-5a88-8948-cc11e1c8c1a6"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"

[compat]
Expand Down
29 changes: 4 additions & 25 deletions src/CUTEst.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ __precompile__()
module CUTEst

using CUTEst_jll
using Pkg.Artifacts
using Libdl

using NLPModels
Expand Down Expand Up @@ -51,10 +52,6 @@ global const cutest_problems_path = joinpath(dirname(@__FILE__), "../deps", "fil
isdir(cutest_problems_path) || mkpath(cutest_problems_path)
global cutest_lib = C_NULL

global __sif_repo_cloned = false
global const __sif_repo_url = "https://bitbucket.org/optrove/sif.git"
global const __local_sif_repo_path = joinpath(@__DIR__, "..", "deps")

function __init__()
if success(`bash -c "type gfortran"`)
@static Sys.isapple() ? (global libgfortran = []) : (global libgfortran = [strip(read(`gfortran --print-file libgfortran.so`, String))])
Expand All @@ -69,11 +66,7 @@ function __init__()

# set default MASTSIF location if the user hasn't set it already
if !("MASTSIF" keys(ENV))
if ispath(joinpath(__local_sif_repo_path, "sif", ".git"))
ENV["MASTSIF"] = joinpath(__local_sif_repo_path, "sif")
else
ENV["MASTSIF"] = joinpath(ENV["CUTEST"], "sif")
end
ENV["MASTSIF"] = joinpath(ENV["CUTEST"], "sif")
end
@info "using problem repository" ENV["MASTSIF"]

Expand Down Expand Up @@ -115,24 +108,10 @@ include("classification.jl")
"""
fetch_sif_problems()
Clone the git repository of SIF problems and reset the MASTSIF environment variable to its location.
Download the SIF collection and reset the MASTSIF environment variable to its location.
"""
function fetch_sif_problems()
global __sif_repo_cloned, __local_sif_repo_path
if isdir(joinpath(__local_sif_repo_path, "sif"))
@info "updating SIF repository"
cd(joinpath(__local_sif_repo_path, "sif")) do
run(`git pull`)
end
else
mkpath(__local_sif_repo_path)
@info "cloning SIF repository"
cd(__local_sif_repo_path) do
run(`git clone $__sif_repo_url`)
end
__sif_repo_cloned = true
end
ENV["MASTSIF"] = joinpath(__local_sif_repo_path, "sif")
ENV["MASTSIF"] = joinpath(artifact"sifcollection", "optrove-sif-99c5b38e7d03")
@info "using problem repository" ENV["MASTSIF"]
nothing
end
Expand Down
2 changes: 2 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
using Test, CUTEst, NLPModels, LinearAlgebra, SparseArrays, Random, Printf

fetch_sif_problems()
@test ispath(ENV["MASTSIF"])
@test isfile(joinpath(ENV["MASTSIF"], "CYCLOOCT.SIF"))

# :hs10 removed from the tests because of
# https://github.com/JuliaSmoothOptimizers/CUTEst.jl/issues/113
Expand Down

0 comments on commit 6c50cd2

Please sign in to comment.