oscar: integrating gap and julia - sebastian gutsche · oscar: integrating gap and julia...

95
OSCAR: Integrating GAP and Julia Sebastian Gutsche University of Siegen South Bend, July 24, 2018

Upload: others

Post on 11-Jul-2020

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

OSCAR: Integrating GAP and Julia

Sebastian Gutsche

University of Siegen

South Bend, July 24, 2018

Page 2: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Outline

1 Introduction to OSCAR

2 GAP-Julia Integration

3 Integration vs. Interfacing

Gutsche OSCAR: Integrating GAP and Julia

Page 3: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Outline

1 Introduction to OSCAR

2 GAP-Julia Integration

3 Integration vs. Interfacing

Gutsche OSCAR: Integrating GAP and Julia

Page 4: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Outline

1 Introduction to OSCAR

2 GAP-Julia Integration

3 Integration vs. Interfacing

Gutsche OSCAR: Integrating GAP and Julia

Page 5: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

People

All of this is joint work with

William Hart (TU Kaiserslautern)Thomas Breuer (RWTH Aachen)Reimer Behrends (TU Kaiserslautern)Max Horn (JLU Gießen)Markus Pfeiffer (University of St Andrews)...

For a complete list of people involved in the various parts ofOSCAR, see https://oscar.computeralgebra.de/credits.

Gutsche OSCAR: Integrating GAP and Julia

Page 6: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

People

All of this is joint work with

William Hart (TU Kaiserslautern)Thomas Breuer (RWTH Aachen)Reimer Behrends (TU Kaiserslautern)Max Horn (JLU Gießen)Markus Pfeiffer (University of St Andrews)...

For a complete list of people involved in the various parts ofOSCAR, see https://oscar.computeralgebra.de/credits.

Gutsche OSCAR: Integrating GAP and Julia

Page 7: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Outline

1 Introduction to OSCAR

2 GAP-Julia Integration

3 Integration vs. Interfacing

Gutsche OSCAR: Integrating GAP and Julia

Page 8: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Overview

Examples:

Multigraded equivariant COX rings oftoric varieties over number fields

Graphs of groups in division algebras

Matrix groups over polynomial ringswith coefficients in number fields

Gröbner fans over fields withdiscrete valuations

Visionary system surpassing the combinedcapabilities of the underlying systems

GAP: computational discrete al-gebra, group and representa-tion theory, general purpose highlevel interpreted programminglanguage.

Singular: polynomial computa-tions, with emphasis on algebraicgeometry, commutative algebra,and singularity theory.

polymake: convex polytopes,polyhedral and stacky fans, sim-plicial complexes and related ob-jects from combinatorics and ge-ometry.

ANTIC: number theoretic soft-ware featuring computationsin and with number fields andgeneric finitely presented rings.

Gutsche OSCAR: Integrating GAP and Julia

Page 9: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The vision for OSCAR

Create a new CAS integrating GAP, Singular, polymake, andANTIC as tight as possible.

This meansremoving the barriers between systems by unifying low-leveldata structures;make all functionality from each system available in everyother system;make all systems share a common mid-level programming layer.

Gutsche OSCAR: Integrating GAP and Julia

Page 10: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The vision for OSCAR

Create a new CAS integrating GAP, Singular, polymake, andANTIC as tight as possible. This means

removing the barriers between systems by unifying low-leveldata structures;

make all functionality from each system available in everyother system;make all systems share a common mid-level programming layer.

Gutsche OSCAR: Integrating GAP and Julia

Page 11: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The vision for OSCAR

Create a new CAS integrating GAP, Singular, polymake, andANTIC as tight as possible. This means

removing the barriers between systems by unifying low-leveldata structures;make all functionality from each system available in everyother system;

make all systems share a common mid-level programming layer.

Gutsche OSCAR: Integrating GAP and Julia

Page 12: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The vision for OSCAR

Create a new CAS integrating GAP, Singular, polymake, andANTIC as tight as possible. This means

removing the barriers between systems by unifying low-leveldata structures;make all functionality from each system available in everyother system;make all systems share a common mid-level programming layer.

Gutsche OSCAR: Integrating GAP and Julia

Page 13: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The role of Julia

We use Julia as a powerful mid-level programming layer.

Thisincludes

bi-directional interfaces from all systems to Julia, so Julia canbe used as a communication layer;possibility to extend systems with Julia code, making use ofJulia’s powerful JIT-compiler, type system, and extensivelibrary.

Gutsche OSCAR: Integrating GAP and Julia

Page 14: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The role of Julia

We use Julia as a powerful mid-level programming layer. Thisincludes

bi-directional interfaces from all systems to Julia, so Julia canbe used as a communication layer;

possibility to extend systems with Julia code, making use ofJulia’s powerful JIT-compiler, type system, and extensivelibrary.

Gutsche OSCAR: Integrating GAP and Julia

Page 15: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The role of Julia

We use Julia as a powerful mid-level programming layer. Thisincludes

bi-directional interfaces from all systems to Julia, so Julia canbe used as a communication layer;possibility to extend systems with Julia code, making use ofJulia’s powerful JIT-compiler,

type system, and extensivelibrary.

Gutsche OSCAR: Integrating GAP and Julia

Page 16: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The role of Julia

We use Julia as a powerful mid-level programming layer. Thisincludes

bi-directional interfaces from all systems to Julia, so Julia canbe used as a communication layer;possibility to extend systems with Julia code, making use ofJulia’s powerful JIT-compiler, type system,

and extensivelibrary.

Gutsche OSCAR: Integrating GAP and Julia

Page 17: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

The role of Julia

We use Julia as a powerful mid-level programming layer. Thisincludes

bi-directional interfaces from all systems to Julia, so Julia canbe used as a communication layer;possibility to extend systems with Julia code, making use ofJulia’s powerful JIT-compiler, type system, and extensivelibrary.

Gutsche OSCAR: Integrating GAP and Julia

Page 18: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integration

ANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 19: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in Julia

SingularAll kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 20: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 21: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jl

Currently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 22: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jl

Ring data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 23: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 24: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymake

Prototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 25: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 26: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Current state

Current state of the integrationANTIC is written in JuliaSingular

All kernel functionality is accessible via Singular.jlCurrently in preparation: A Singular interpreter written inJulia, using Singular.jlRing data structures implemented in Julia can be used ascoefficient rings for polynomials

polymakePrototype for accessing most polymake functionality from Julia

GAP: Second part of talk

Gutsche OSCAR: Integrating GAP and Julia

Page 27: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Example: Using Singular with Nemo rings

Example for using Nemo number fields as coefficient rings inSingular

Julia_rings_with_Singular.ipynb

Gutsche OSCAR: Integrating GAP and Julia

Page 28: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Resources

All information about the OSCAR project can be found on

https://oscar.computeralgebra.de

On the page you can find

news,blog posts,examples,and installation instructions.

Gutsche OSCAR: Integrating GAP and Julia

Page 29: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Resources

All information about the OSCAR project can be found on

https://oscar.computeralgebra.de

On the page you can find

news,blog posts,examples,and installation instructions.

Gutsche OSCAR: Integrating GAP and Julia

Page 30: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Outline

1 Introduction to OSCAR

2 GAP-Julia Integration

3 Integration vs. Interfacing

Gutsche OSCAR: Integrating GAP and Julia

Page 31: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 32: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 33: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provide

Conversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 34: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and Julia

Use of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 35: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAP

Use of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 36: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in Julia

Possibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 37: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 38: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface and GAP.jl

GAP package JuliaInterface and Julia module GAP.jl

GAP Julia

JuliaInterface and GAP.jl provideConversion of basic data types (e.g., integers, lists,permutations) between GAP and JuliaUse of GAP data types in Julia and Julia data types in GAPUse of Julia functions in GAP and GAP functions in JuliaPossibility to add compiled Julia functions as kernel functionsto GAP

https://github.com/oscar-system

Gutsche OSCAR: Integrating GAP and Julia

Page 39: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 40: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 41: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 42: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 43: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

Integers

FloatsStringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 44: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloats

StringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 45: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStrings

BooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 46: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStringsBooleans

Nested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 47: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Objects

JuliaInterface contains GAP data structures that can hold pointersto Julia objects:

gap> a := 2;2

gap> b := ConvertedToJulia( a );<Julia: 2>

gap> ConvertedFromJulia( b );2

Possible conversions:

IntegersFloatsStringsBooleansNested lists of the above to Arrays or Tuples

Gutsche OSCAR: Integrating GAP and Julia

Page 48: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Functions

JuliaInterface provides the possibility to call Julia functions byconverting GAP objects:

gap> ImportJuliaModuleIntoGAP( "Base" );

gap> Julia.Base.sqrt( 4 );<Julia: 2.0>

Julia functions can be used like GAP functionsIf necessary and possible, input data is converted to JuliaCalling only possible for convertible types and Julia objects

Gutsche OSCAR: Integrating GAP and Julia

Page 49: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Functions

JuliaInterface provides the possibility to call Julia functions byconverting GAP objects:

gap> ImportJuliaModuleIntoGAP( "Base" );

gap> Julia.Base.sqrt( 4 );<Julia: 2.0>

Julia functions can be used like GAP functionsIf necessary and possible, input data is converted to JuliaCalling only possible for convertible types and Julia objects

Gutsche OSCAR: Integrating GAP and Julia

Page 50: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Functions

JuliaInterface provides the possibility to call Julia functions byconverting GAP objects:

gap> ImportJuliaModuleIntoGAP( "Base" );

gap> Julia.Base.sqrt( 4 );<Julia: 2.0>

Julia functions can be used like GAP functionsIf necessary and possible, input data is converted to JuliaCalling only possible for convertible types and Julia objects

Gutsche OSCAR: Integrating GAP and Julia

Page 51: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Functions

JuliaInterface provides the possibility to call Julia functions byconverting GAP objects:

gap> ImportJuliaModuleIntoGAP( "Base" );

gap> Julia.Base.sqrt( 4 );<Julia: 2.0>

Julia functions can be used like GAP functions

If necessary and possible, input data is converted to JuliaCalling only possible for convertible types and Julia objects

Gutsche OSCAR: Integrating GAP and Julia

Page 52: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Functions

JuliaInterface provides the possibility to call Julia functions byconverting GAP objects:

gap> ImportJuliaModuleIntoGAP( "Base" );

gap> Julia.Base.sqrt( 4 );<Julia: 2.0>

Julia functions can be used like GAP functionsIf necessary and possible, input data is converted to Julia

Calling only possible for convertible types and Julia objects

Gutsche OSCAR: Integrating GAP and Julia

Page 53: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface data structures: Functions

JuliaInterface provides the possibility to call Julia functions byconverting GAP objects:

gap> ImportJuliaModuleIntoGAP( "Base" );

gap> Julia.Base.sqrt( 4 );<Julia: 2.0>

Julia functions can be used like GAP functionsIf necessary and possible, input data is converted to JuliaCalling only possible for convertible types and Julia objects

Gutsche OSCAR: Integrating GAP and Julia

Page 54: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions (from orbits.jl):

function orbit( element, generators, action )work_set = [ element ]return_set = [ element ]generator_length = gap_LengthPlist(generators)while length(work_set) != 0

current_element = pop!(work_set)for current_generator_number = 1:generator_length

current_generator = gap_ListElement(generators,current_generator_number)

current_result = gap_CallFunc2Args(action,current_element,current_generator)

is_in_set = falsefor i in return_set

if i == current_resultis_in_set = truebreak

endendif ! is_in_set

push!( work_set, current_result )push!( return_set, current_result )

endend

endreturn return_set

end

Gutsche OSCAR: Integrating GAP and Julia

Page 55: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions (from orbits.jl):

function orbit( element, generators, action )work_set = [ element ]return_set = [ element ]generator_length = gap_LengthPlist(generators)while length(work_set) != 0

current_element = pop!(work_set)for current_generator_number = 1:generator_length

current_generator = gap_ListElement(generators,current_generator_number)

current_result = gap_CallFunc2Args(action,current_element,current_generator)

is_in_set = falsefor i in return_set

if i == current_resultis_in_set = truebreak

endendif ! is_in_set

push!( work_set, current_result )push!( return_set, current_result )

endend

endreturn return_set

end

Gutsche OSCAR: Integrating GAP and Julia

Page 56: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 57: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 58: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 59: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 60: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 61: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 62: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

JuliaInterface: Julia functions as kernel modules

Using JuliaInterface, it is possible to write Julia functions and usethem as GAP kernel functions:

gap> JuliaIncludeFile( "orbits.jl" );gap> JuliaBindCFunction( "orbit", "orbit_jl", 3 );

Compiled Julia functions come close to the performance of kernelfunctions:

gap> S := GeneratorsOfGroup( SymmetricGroup( 10000 ) );;

gap> orbit_gap( 1, S, OnPoints );; time;5769

gap> orbit_jl( 1, S, OnPoints );; time;84

gap> orbit_c( 1, S, OnPoints );; time;46

Gutsche OSCAR: Integrating GAP and Julia

Page 63: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

GAP.jl: using GAP from Julia

The Julia module GAP.jl provides access to GAP’s data structuresand functions from Julia

julia> S3 = GAP.SymmetricGroup( LibGAP.to_gap( 3 ) )GAP: SymmetricGroup( [ 1 .. 3 ] )

julia> size_gap = GAP.Size( S3 )GAP: 6

julia> LibGAP.from_gap( size_gap, Int64 )6

Gutsche OSCAR: Integrating GAP and Julia

Page 64: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

GAP.jl: using GAP from Julia

The Julia module GAP.jl provides access to GAP’s data structuresand functions from Julia

julia> S3 = GAP.SymmetricGroup( LibGAP.to_gap( 3 ) )GAP: SymmetricGroup( [ 1 .. 3 ] )

julia> size_gap = GAP.Size( S3 )GAP: 6

julia> LibGAP.from_gap( size_gap, Int64 )6

Gutsche OSCAR: Integrating GAP and Julia

Page 65: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

GAP.jl: using GAP from Julia

The Julia module GAP.jl provides access to GAP’s data structuresand functions from Julia

julia> S3 = GAP.SymmetricGroup( LibGAP.to_gap( 3 ) )GAP: SymmetricGroup( [ 1 .. 3 ] )

julia> size_gap = GAP.Size( S3 )GAP: 6

julia> LibGAP.from_gap( size_gap, Int64 )6

Gutsche OSCAR: Integrating GAP and Julia

Page 66: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

GAP.jl: using GAP from Julia

The Julia module GAP.jl provides access to GAP’s data structuresand functions from Julia

julia> S3 = GAP.SymmetricGroup( LibGAP.to_gap( 3 ) )GAP: SymmetricGroup( [ 1 .. 3 ] )

julia> size_gap = GAP.Size( S3 )GAP: 6

julia> LibGAP.from_gap( size_gap, Int64 )6

Gutsche OSCAR: Integrating GAP and Julia

Page 67: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 68: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

Speedup

Now: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 69: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.

Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 70: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 71: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:

Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 72: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than C

Extensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 73: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 74: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the GAP side

How does GAP benefit from Julia/OSCAR (except mathematicalalgorithms)?

SpeedupNow: Find time critical parts of algorithms, rewrite them in C.Future: Find time critical parts of algorithms, rewrite them inJulia.

Benefits:Higher level language, which may be easier to use than CExtensive functionality available in standard modules

Gutsche OSCAR: Integrating GAP and Julia

Page 75: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the OSCAR side

How does OSCAR benefit from GAP (except mathematicalalgorithms)?

Language featuresFlexible type system: Objects can learn about themselvesBuilt-in traits: Known properties of objects decide whichvariant of an algorithm to useImmediate propagation: Second execution layer is used tospread properties between objectsCategorical programming language as defined in the CAPproject

Gutsche OSCAR: Integrating GAP and Julia

Page 76: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the OSCAR side

How does OSCAR benefit from GAP (except mathematicalalgorithms)?

Language features

Flexible type system: Objects can learn about themselvesBuilt-in traits: Known properties of objects decide whichvariant of an algorithm to useImmediate propagation: Second execution layer is used tospread properties between objectsCategorical programming language as defined in the CAPproject

Gutsche OSCAR: Integrating GAP and Julia

Page 77: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the OSCAR side

How does OSCAR benefit from GAP (except mathematicalalgorithms)?

Language featuresFlexible type system: Objects can learn about themselves

Built-in traits: Known properties of objects decide whichvariant of an algorithm to useImmediate propagation: Second execution layer is used tospread properties between objectsCategorical programming language as defined in the CAPproject

Gutsche OSCAR: Integrating GAP and Julia

Page 78: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the OSCAR side

How does OSCAR benefit from GAP (except mathematicalalgorithms)?

Language featuresFlexible type system: Objects can learn about themselvesBuilt-in traits: Known properties of objects decide whichvariant of an algorithm to use

Immediate propagation: Second execution layer is used tospread properties between objectsCategorical programming language as defined in the CAPproject

Gutsche OSCAR: Integrating GAP and Julia

Page 79: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the OSCAR side

How does OSCAR benefit from GAP (except mathematicalalgorithms)?

Language featuresFlexible type system: Objects can learn about themselvesBuilt-in traits: Known properties of objects decide whichvariant of an algorithm to useImmediate propagation: Second execution layer is used tospread properties between objects

Categorical programming language as defined in the CAPproject

Gutsche OSCAR: Integrating GAP and Julia

Page 80: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

From the OSCAR side

How does OSCAR benefit from GAP (except mathematicalalgorithms)?

Language featuresFlexible type system: Objects can learn about themselvesBuilt-in traits: Known properties of objects decide whichvariant of an algorithm to useImmediate propagation: Second execution layer is used tospread properties between objectsCategorical programming language as defined in the CAPproject

Gutsche OSCAR: Integrating GAP and Julia

Page 81: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Example: Using Singular in GAP via Julia

Example for using Singular in GAP via Julia

Using Singular from GAP.ipynb

Gutsche OSCAR: Integrating GAP and Julia

Page 82: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Outline

1 Introduction to OSCAR

2 GAP-Julia Integration

3 Integration vs. Interfacing

Gutsche OSCAR: Integrating GAP and Julia

Page 83: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Problems when interfacing two garbage collected systems

Primitive approach: System A holds a list of objects otherwise onlyrefered to by System B, and vice versa.

This approach can be implemented using build-in techniques inGAP and Julia, butit adds a layer of indirections and causes inefficiencies andunreachable cycles that involve both GAP and Julia objectscannot be reclaimed, so it leads to memory leaks.

Gutsche OSCAR: Integrating GAP and Julia

Page 84: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Problems when interfacing two garbage collected systemsPrimitive approach: System A holds a list of objects otherwise onlyrefered to by System B, and vice versa.

This approach can be implemented using build-in techniques inGAP and Julia, butit adds a layer of indirections and causes inefficiencies andunreachable cycles that involve both GAP and Julia objectscannot be reclaimed, so it leads to memory leaks.

Gutsche OSCAR: Integrating GAP and Julia

Page 85: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Problems when interfacing two garbage collected systemsPrimitive approach: System A holds a list of objects otherwise onlyrefered to by System B, and vice versa.

This approach can be implemented using build-in techniques inGAP and Julia, but

it adds a layer of indirections and causes inefficiencies andunreachable cycles that involve both GAP and Julia objectscannot be reclaimed, so it leads to memory leaks.

Gutsche OSCAR: Integrating GAP and Julia

Page 86: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Problems when interfacing two garbage collected systemsPrimitive approach: System A holds a list of objects otherwise onlyrefered to by System B, and vice versa.

This approach can be implemented using build-in techniques inGAP and Julia, butit adds a layer of indirections and causes inefficiencies and

unreachable cycles that involve both GAP and Julia objectscannot be reclaimed, so it leads to memory leaks.

Gutsche OSCAR: Integrating GAP and Julia

Page 87: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Problems when interfacing two garbage collected systemsPrimitive approach: System A holds a list of objects otherwise onlyrefered to by System B, and vice versa.

This approach can be implemented using build-in techniques inGAP and Julia, butit adds a layer of indirections and causes inefficiencies andunreachable cycles that involve both GAP and Julia objectscannot be reclaimed, so it leads to memory leaks.

Gutsche OSCAR: Integrating GAP and Julia

Page 88: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and JuliaChanges to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAPThus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 89: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and Julia

Changes to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAPThus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 90: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and JuliaChanges to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAPThus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 91: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and JuliaChanges to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1

Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAPThus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 92: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and JuliaChanges to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAPThus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 93: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and JuliaChanges to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAP

Thus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 94: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Integration vs. Interfacing

Q: How does OSCAR’s Julia-GAP integration differ from classicalinterfacing?

Using the same GC for GAP and JuliaChanges to GAP and Julia to make it possible to use Julia’sGC simultaneously for GAP and Julia (Behrends/Horn)

Changes to Julia accepted, will be part of 1.1Changes to GAP accepted, will be part of 4.10 (TBR inDecember)

This way, all GAP objects are first-class citizens in Julia, andJulia objects are first class citizens in GAPThus using Julia objects from GAP and GAP objects from Juliaworks without any GC overhead (essentially no penalty at all)

Gutsche OSCAR: Integrating GAP and Julia

Page 95: OSCAR: Integrating GAP and Julia - Sebastian Gutsche · OSCAR: Integrating GAP and Julia SebastianGutsche University of Siegen SouthBend,July24,2018

Acknowledgements

Gutsche OSCAR: Integrating GAP and Julia