Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge libsingular-julia back into Singular.jl #657

Merged
merged 122 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
122 commits
Select commit Hold shift + click to select a range
487b0eb
bla
thofma Aug 25, 2020
f8b2c0a
Cleanup
thofma Aug 25, 2020
2a2028d
Create README.md
thofma Aug 29, 2020
ae99dde
Fix some signatures: use int64 instead of long
fingolfin Oct 16, 2020
2bd593d
add id_LiftStd
hannes14 Nov 30, 2020
2c3e5ff
fix: id_LiftStd
hannes14 Dec 1, 2020
a34fae1
Lift std (#4)
hannes14 Dec 4, 2020
9d71a34
"fix" CmakeFile and add a build.jl (#5)
fieker Dec 7, 2020
4bef566
better support fro lift_std (#6)
fieker Dec 8, 2020
17ac86e
Improve build.jl
fingolfin Dec 21, 2020
a90c03e
Remove n_Delete_Q (#7)
fingolfin Jan 9, 2021
98eac5c
Make n_InpMult actually useful (#8)
fingolfin Jan 9, 2021
c5299a8
more functions for ring identification (#9)
tthsqe12 Jan 13, 2021
181691e
First try on conversion of Singular.jl arrays to Singular lists (#10)
Feb 10, 2021
46b6898
getting and setting the minpoly (#11)
tthsqe12 Feb 10, 2021
cf08dd2
Update README.md
thofma Feb 11, 2021
fa0073d
Update README.md
tthsqe12 Mar 5, 2021
0e0e88a
add irrCharSeries (#13)
hannes14 Mar 11, 2021
1bf7e19
add some options capabilities (#12)
tthsqe12 Mar 12, 2021
b8128eb
Add very simple CI test
fingolfin Mar 12, 2021
c625dd9
Fix the CI on macOS (oops)
fingolfin Mar 12, 2021
b4770e2
Use CMake.jl to get cmake
fingolfin Mar 12, 2021
a268a38
CI: allow errors with nightly Julia versions
fingolfin Mar 12, 2021
71bf7d0
Add run.jl helper: run Julia with artifacts override
fingolfin Mar 12, 2021
f991094
oscarci: add github_token to avoid rate limit
benlorenz May 6, 2021
0b0a4d8
Fix for Julia 1.6: ensure gmp.h is available
fingolfin Mar 19, 2021
ff3ac5a
run.jl: show which libsingular_julia is in use
benlorenz May 6, 2021
889e2d9
run OscarCI for downstream testing
benlorenz Mar 19, 2021
8ed31ca
Avoid trivial wrappers
fingolfin Mar 24, 2021
08e82e6
test: try if adding 1.6 to the list works now
benlorenz May 6, 2021
9bcfed3
Update .github/workflows/oscar.yml
benlorenz Apr 21, 2021
a7372ee
CI: test with Julia 1.6
fingolfin Mar 26, 2021
897751d
test: separate 1.6 again
benlorenz May 6, 2021
498d750
Merge pull request #21 from benlorenz/bl/run_jll_oscarci
tthsqe12 Apr 21, 2021
4b2f8e9
run.jl: make sure that precompilation is run again with the override …
benlorenz May 6, 2021
992954a
add ideal version of mp_MultP (#23)
tthsqe12 Apr 21, 2021
317617d
Merge pull request #27 from benlorenz/bl/oscarci
tthsqe12 May 7, 2021
2dc7825
fix transExt_to_poly nullptr (#30)
tthsqe12 May 7, 2021
b758f00
reset errorreported + use singular_error + tweaks (#29)
tthsqe12 May 10, 2021
db6a529
n_algExt -> n_transExt conversion (#31)
tthsqe12 May 10, 2021
ffb3b9d
proper num/den and gcdx + normalize for QQ (#25)
tthsqe12 May 10, 2021
5b7c90a
add some functions for communicating orderings (#26)
tthsqe12 May 10, 2021
3dbf51c
add scDimIntRing (#32)
tthsqe12 Jun 9, 2021
eae2b9a
missing matrix cmds
tthsqe12 Jun 29, 2021
07f830b
transExt_to_algExt conversion
tthsqe12 Jul 13, 2021
8655347
add second lift and a correct gcdx
tthsqe12 Jul 13, 2021
971a8bf
add id_InterRed
hannes14 Jul 27, 2021
52d1c5d
Update oscar.yml
thofma Jul 28, 2021
532e68d
start singular's bigint and bigintmat
tthsqe12 Jul 30, 2021
a9976cb
Merge pull request #36 from hannes14/interred
tthsqe12 Jul 28, 2021
d482bb4
Merge pull request #37 from tthsqe12/start_bigintmat
tthsqe12 Aug 9, 2021
89896da
fix weyl and exterior algebra constructors
tthsqe12 Oct 12, 2021
232822d
add lookup_singular_library_symbol_wo_rng
tthsqe12 Aug 9, 2021
76f01b7
add p_Mult_nn
tthsqe12 Oct 13, 2021
b7c275d
apply comments
tthsqe12 Aug 9, 2021
8914fa2
add G-algebra constructor
tthsqe12 Oct 14, 2021
20136fb
explain return convention
tthsqe12 Aug 9, 2021
b929aa8
fix some spacings
tthsqe12 Oct 15, 2021
47fa517
change return convention
tthsqe12 Aug 9, 2021
7ab694b
add p_LmIsConstant
tthsqe12 Oct 18, 2021
68c7fcc
add nCoeff_is_Z
hannes14 Aug 31, 2021
072a33d
ci bump
tthsqe12 Aug 9, 2021
bf1f90f
add rIsLPRing
tthsqe12 Oct 19, 2021
903591c
Merge pull request #40 from hannes14/nCoeff_is_Z
hannes14 Sep 3, 2021
779598e
refactor weyl and exterior algebra
tthsqe12 Oct 20, 2021
13fba1a
singular's degree and mult commands
tthsqe12 Sep 14, 2021
aa5cc7d
add twostd
tthsqe12 Oct 21, 2021
a59f544
remove support for julia < 1.6
tthsqe12 Oct 19, 2021
c687908
add rIsPluralRing
tthsqe12 Oct 22, 2021
9cb04ff
remove support for julia < 1.6
tthsqe12 Oct 20, 2021
464d12d
don't always write to stderr
tthsqe12 Nov 10, 2021
9d0b451
avoid using n_Init with ring as second arugment
tthsqe12 Oct 23, 2021
75062dd
Merge pull request #43 from tthsqe12/ncalg
tthsqe12 Oct 22, 2021
9e3ad75
threshold based on number of errors, not number of characters
tthsqe12 Nov 11, 2021
7f3fa4c
Merge pull request #45 from tthsqe12/nInit_quickfix
tthsqe12 Oct 26, 2021
bb330f4
Merge pull request #47 from tthsqe12/less_noise
tthsqe12 Nov 11, 2021
4063cbf
add degBound and multBound setters
tthsqe12 Nov 25, 2021
f6bea85
add pMultMp
tthsqe12 Nov 17, 2021
ee73db2
add scHilbWeighted (weighted Hilbert series)
hannes14 Feb 18, 2022
75c9473
Merge pull request #50 from tthsqe12/global_variables
tthsqe12 Jan 18, 2022
67f54ae
fix memory leaks with intvec
hannes14 Feb 18, 2022
7a015c9
add two arg kbase (#51)
tthsqe12 Jan 31, 2022
46f48f6
Update coeffs.cpp
tthsqe12 Mar 21, 2022
4e07a94
Merge pull request #52 from hannes14/scHilbWeighted
tthsqe12 Mar 17, 2022
bf48621
Merge pull request #53 from oscar-system/tthsqe12-patch-1
tthsqe12 Mar 21, 2022
60a1b94
some opposite functions
tthsqe12 Sep 6, 2022
50a3551
Merge pull request #58 from tthsqe12/opposites
tthsqe12 Sep 12, 2022
8d6cbdd
this needs to be copied
tthsqe12 Oct 28, 2022
cec6bff
pass flag to p_Reduce
hannes14 Oct 26, 2022
6eb901a
CI: update some actions to latest versions
fingolfin Oct 12, 2022
df0a230
change basering for the copies
tthsqe12 Oct 28, 2022
9f9ac0c
Merge pull request #60 from hannes14/flag_for_reduce
tthsqe12 Nov 2, 2022
a7f2af3
missing intvec delete
tthsqe12 Nov 2, 2022
bdb87f9
Merge pull request #61 from tthsqe12/issue595
tthsqe12 Nov 2, 2022
a903f0c
gc protection
tthsqe12 Nov 3, 2022
706a686
Merge pull request #62 from oscar-system/tthsqe12-patch-3
tthsqe12 Nov 3, 2022
237471e
add homogeneous functions
tthsqe12 May 5, 2022
b235d6a
Don't corrupt the ring data. Also, incidentally use lex.
tthsqe12 Nov 11, 2022
0f88583
Merge pull request #63 from tthsqe12/gc_push_pop
tthsqe12 Nov 4, 2022
ba6ac0f
add getter for qideal
tthsqe12 Jul 12, 2022
068f9e7
Merge pull request #55 from tthsqe12/add_is_homogeneous
tthsqe12 May 13, 2022
22649b1
Merge pull request #65 from tthsqe12/stdQt
tthsqe12 Dec 1, 2022
0edd06f
Merge pull request #56 from tthsqe12/better_quotient_rings
tthsqe12 Jul 13, 2022
db7ce96
add functions for std_hilbert
tthsqe12 Dec 7, 2022
175ef19
field for annihilator (#66)
tthsqe12 Dec 2, 2022
dc6a575
Update caller.cpp
tthsqe12 Jul 20, 2022
5084503
Merge pull request #67 from tthsqe12/std_hilbert
tthsqe12 Dec 9, 2022
5c60e60
access to mp_Wedge
hannes14 Feb 17, 2023
ac476f2
Merge pull request #57 from oscar-system/tthsqe12-patch-2
hannes14 Mar 7, 2023
6e26f94
dd flag to id_DivRem, id_DivRem_Unit
hannes14 Apr 18, 2023
42224db
add id_MinStd
hannes14 Mar 17, 2023
b2ad5c9
Merge pull request #68 from hannes14/hs/wedge
hannes14 Mar 7, 2023
37d251d
scHilbWeighted for modules
hannes14 May 8, 2023
a12204a
add id_DivRem, id_DivRem_Unit
hannes14 Mar 17, 2023
7138c27
Merge pull request #70 from hannes14/hs/mstd
hannes14 Mar 20, 2023
be1ac81
add nres/mres: id_res
hannes14 May 11, 2023
b6b5d07
fix extended characters
hannes14 May 8, 2023
e6396d5
Merge pull request #69 from hannes14/hs/divrem
hannes14 Mar 20, 2023
73af1a6
fix syResolvente
hannes14 May 11, 2023
f693c76
Merge pull request #72 from hannes14/hs/scHilbWeighted
hannes14 May 11, 2023
ed99c23
Merge pull request #73 from hannes14/hs/res
hannes14 May 31, 2023
7f80d3d
Merge libsingular-julia back into Singular.jl
fingolfin Jun 6, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 53 additions & 0 deletions deps/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.01)

# I don't know why I need the following, but it works
if(POLICY CMP0025)
cmake_policy(SET CMP0025 NEW)
endif()

project(libsingular_julia)

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")

find_package(JlCxx REQUIRED)

include(CheckCXXCompilerFlag)

set(CMAKE_CXX_STANDARD 14)

set(JLSINGULAR_TARGET singular_julia)

# avoid gcc 9 internal compiler error,
# see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90998
if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 9.0
AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9.3)
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-conversion" )
endif()

# to avoid lib64 dirs as binarybuilder uses lib everywhere
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_INSTALL_LIBDIR "lib")

get_target_property(JlCxx_location JlCxx::cxxwrap_julia LOCATION)
get_filename_component(JlCxx_location ${JlCxx_location} DIRECTORY)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib;${JlCxx_location}")

message(STATUS "Found JlCxx at ${JlCxx_location}")

include_directories(${CMAKE_INSTALL_PREFIX})
include_directories(${Singular_PREFIX}/include/singular)

SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g ${extra_cppflags} -I${CMAKE_INSTALL_PREFIX}/include -I${Singular_PREFIX}/include/" )
SET( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -v ${extra_ldflags} -L${CMAKE_INSTALL_PREFIX}/lib -Wl,-rpath,${CMAKE_INSTALL_PREFIX}/lib -L${Singular_PREFIX}/lib -Wl,-rpath,${Singular_PREFIX}/lib" )


add_library(${JLSINGULAR_TARGET} SHARED singular.cpp rings.cpp coeffs.cpp ideals.cpp matrices.cpp caller.cpp coeff_rings.cpp threading.cpp)

target_link_libraries(${JLSINGULAR_TARGET} JlCxx::cxxwrap_julia -lSingular -lpolys -lsingular_resources -lfactory -lomalloc -ldl -lgmp)

install(TARGETS
${JLSINGULAR_TARGET}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
674 changes: 674 additions & 0 deletions deps/src/LICENSE.md

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions deps/src/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
# libsingular-julia

This is the C++ library accompanying [Singular.jl](https://github.com/oscar-system/Singular.jl).
It implements the C++ interface from julia to Singular using [CxxWrap.jl](https://github.com/JuliaInterop/CxxWrap.jl) and [libcxxwrap-julia](https://github.com/JuliaInterop/libcxxwrap-julia).

This library is compiled into a Julia artifact and shipped to the user via
the Julia JLL package
[libsingular_julia_jll](https://github.com/JuliaBinaryWrappers/libsingular_julia_jll.jl).
This JLL package in turn is generated from the sources in this repository and
the build recipe at
<https://github.com/JuliaPackaging/Yggdrasil/tree/master/L/libsingular_julia>.


## Quick way to test changes in here

To test changes you make to the C++ code here, the quickest way is to use the
`run.jl` script bundled in this repository. As a prerequisite, you need a
working C++ compiler and of course Julia.

Start Julia from this repository as follows:

julia --project=. run.jl

This will install a few required Julia packages then build all C++ code, and
finally start a Julia session with an artifact override in place which ensures
that libsingular_julia_jll picks up the copy of the C++ code that was just
compiled.

To verify the override works, check `libsingular_julia_jll.artifact_dir`; it
should point at a subdirectory of the current directory.

You can then use the Julia package manager to install or dev `Singular.jl`,
and run its test suite or perform other tests.


## Building

Compiling `libsingular-julia` from source requires a C++ enabled compiler.

The easiest way to build it is to execute the Julia script `build.jl` (which
in turn is also used by `run.jl`). For this you need to execute it in a Julia
environment in which `Singular_jll` and `CxxWrap` are installed.

Alternatively, you can also link it against your own `libcxxwrap-julia`
installation and a Singular installation, but this is more work; an
incantation like the following will do it:

```bash
git clone https://github.com/oscar-system/libsingular-julia \
cmake -DJulia_PREFIX=/home/user/path/to/julia \
-DSingular_PREFIX=/home/user/path/to/singular
-DCMAKE_INSTALL_PREFIX=home/user/prefix/for/libsingular-julia \
-DJlCxx_DIR=/home/user/path/to/libcxxwrap-julia/lib/cmake/JlCxx \
-DCMAKE_BUILD_TYPE=Release \
-S libsingular-julia -B build \

cmake --build build --config Release --target install -- -j${nproc}
```


### Overriding the default artifacts for Singular.jl

The `run.jl` script takes care of everything described below, but we document
it in case you need to do any of this manually for some reason.

Put the following into `~/.julia/artifacts/Overrides.toml` to replace the `libsingular-julia` artifact:

```toml
[ae4fbd8f-ecdb-54f8-bbce-35570499b30e]
libsingular_julia = "/home/user/prefix/for/libsingular-julia"
```

If you were using custom versions of `Singular` and/or `libcxxwrap-julia`,
then their directories used during the build need to be added as well, e.g.:

```toml
[bcd08a7b-43d2-5ff7-b6d4-c458787f915c]
Singular = "/home/user/path/to/Singular"

[3eaa8342-bff7-56a5-9981-c04077f7cee7]
libcxxwrap_julia = "/home/user/path/to/libcxxwrap-julia"
```
46 changes: 46 additions & 0 deletions deps/src/build.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import Singular_jll, CxxWrap, CMake
using Singular_jll.GMP_jll, Pkg.Artifacts

# TODO: use ARGS to specify custom build dir?
builddir = "build"
installdir = abspath("install")
JlCxx_DIR = joinpath(CxxWrap.prefix_path(), "lib", "cmake", "JlCxx")

# In Julia >= 1.6, there is a "fake" GMP_jll which does not include header files;
# see <https://github.com/JuliaLang/julia/pull/38797#issuecomment-741953480>
function gmp_artifact_dir()
artifacts_toml = joinpath(dirname(dirname(Base.pathof(GMP_jll))), "StdlibArtifacts.toml")

# If this file exists, it's a stdlib JLL and we must download the artifact ourselves
if isfile(artifacts_toml)
meta = artifact_meta("GMP", artifacts_toml)
hash = Base.SHA1(meta["git-tree-sha1"])
if !artifact_exists(hash)
dl_info = first(meta["download"])
download_artifact(hash, dl_info["url"], dl_info["sha256"])
end
return artifact_path(hash)
end

# Otherwise, we can just use the artifact directory given to us by GMP_jll
return GMP_jll.find_artifact_dir()
end

const gmp_prefix = gmp_artifact_dir()
const singular_prefix = Singular_jll.artifact_dir

rm(builddir; force=true, recursive=true)

run(`$(CMake.cmake)
-DJulia_EXECUTABLE=$(joinpath(Sys.BINDIR, Base.julia_exename()))
-Dextra_cppflags=-I$(gmp_prefix)/include
-Dextra_ldflags=-L$(gmp_prefix)/lib
-DSingular_PREFIX=$(singular_prefix)
-DCMAKE_INSTALL_PREFIX=$(installdir)
-DJlCxx_DIR=$(JlCxx_DIR)
-DCMAKE_BUILD_TYPE=Release
-S .
-B $(builddir)
`)

run(`$(CMake.cmake) --build $(builddir) --config Release --target install -- -j$(Sys.CPU_THREADS)`)
Loading