Re: [sage-support] Re: Tracking memory usage and time

2019-09-03 Thread J
On 19-09-03 11:31:32, Nils Bruin wrote:
>
>
> On Tuesday, September 3, 2019 at 2:43:27 AM UTC-7, Jori Mäntysalo (TAU)
> wrote:
> >
> > There is also at least %mprun magic. Googling that will give you some
> > examples.
> >
> > Looking at the memory footprint of the entire process (as a function of
> time) gives some indication of memory use of a certain implementation of an
> algorithm, but there are many factors that influence it. CPython probably
> has a slight preference for reusing (freed/reclaimed) memory over
> requesting new memory from the OS, but there is not an actual guarantee.
> And CPython might be seriously lax in reclaiming memory, or it might be
> prevented by a memory leak in sage that is not due to the implementation of
> the algorithm. So you can take results like that only as an indication and
> not as authoritative. Determining memory usage of an algorithm in the
> mathematical sense probably needs code analysis.
>
> (that said, memory claimed from the OS definitely gives an UPPER BOUND on
> the memory usage of a certain algorithm; for obvious reasons)
>

Well, one of the algorithms stores

sum {l^e} {\binom{n}{e}}

with l being the number of elements of the field
which gets big quite fast

> --
> You received this message because you are subscribed to the Google Groups 
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-support/66674d87-2f64-4da1-89f9-009b2898d3a4%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/20190903195428.zge4htnopcsadfko%40deathbolt.927589452.space.


Re: [sage-support] Re: Tracking memory usage and time

2019-09-03 Thread Nils Bruin


On Tuesday, September 3, 2019 at 2:43:27 AM UTC-7, Jori Mäntysalo (TAU) 
wrote:
>
> There is also at least %mprun magic. Googling that will give you some 
> examples. 
>
> Looking at the memory footprint of the entire process (as a function of 
time) gives some indication of memory use of a certain implementation of an 
algorithm, but there are many factors that influence it. CPython probably 
has a slight preference for reusing (freed/reclaimed) memory over 
requesting new memory from the OS, but there is not an actual guarantee. 
And CPython might be seriously lax in reclaiming memory, or it might be 
prevented by a memory leak in sage that is not due to the implementation of 
the algorithm. So you can take results like that only as an indication and 
not as authoritative. Determining memory usage of an algorithm in the 
mathematical sense probably needs code analysis.

(that said, memory claimed from the OS definitely gives an UPPER BOUND on 
the memory usage of a certain algorithm; for obvious reasons)

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/66674d87-2f64-4da1-89f9-009b2898d3a4%40googlegroups.com.


[sage-support] Re: Tracking memory usage and time

2019-09-03 Thread Simon King
On 2019-09-03, Jori Mäntysalo  wrote:
> On Mon, 2 Sep 2019, J wrote:
>
>> Thanks get_memory_usage sounds good; I want to run several decoders from
>> the coding theory module to see better show there ups and downs;
>
> There is also at least %mprun magic. Googling that will give you some 
> examples.

Cool! I didn't know about %mprun before.

Thanks!
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/qkm6b8%241593%242%40blaine.gmane.org.


[sage-support] Re: Cannot load session create in another version of sage

2019-09-03 Thread Simon King
Hi Vincent,

On 2019-09-03, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
>> In fact it isn't compatible, but that of course means it must be
>> attempted to make it compatible.
>
> It is already compatible. You just need to specify which kind of
> data has been pickled ('bytes' vs 'str')

I disagree. When you pickle a Python-2 str and unpickle with Python-3,
you get a Python-3 str. And that's a problem, as Python-2 str
corresponds to Python-3 bytes, whereas Python-3 str corresponds to
Python-2 unicode. Moreover, the attempt to unpickle a Python-2 str as a
Python-3 str can fail.

Of course it is possible that you tell Python-3 to unpickle Python-2 str
as bytes (namely by pickle.load(, encoding="bytes")). But can we
really say that things are *compatible* if an apple (Python-2 str) is
unpickled as a banana (Python-3 str)? And can we really say that things
*are* compatible when compatibility can only be achieved by providing an
optional keyword argument?

Anyway. After I learned about the `encoding` keyword, I opened #28444,
where I propose to add the `encoding` keyword to Sage's `load` function,
so that it can be passed to pickle.load.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/qkm69r%241593%241%40blaine.gmane.org.


[sage-support] MixedIntegerLinearProgram: How to use Gurobi backend on macOS?

2019-09-03 Thread Szabolcs Horvát
Is it possible to use the Gurobi backend to MixedIntegerLinearProgram on 
macOS?

The documentation for getting it working seems to be here and seems to be 
Linux-specific:

http://doc.sagemath.org/html/en/thematic_tutorials/linear_programming.html#using-cplex-or-gurobi-through-sage

I tried to follow it for macOS anyway. I have the official app distribution 
of SageMath 8.8 and Gurobi 8.1.1. I symlinked libgurobi81.dylib and 
gurobi_c.h in the indicated locations, set the environment variable for the 
license file, then went to SAGE_ROOT and ran 'make'. This complained that I 
have MacPorts. I removed MacPorts from the PATH, and tried again. It 
re-built Sage (in part?) which took about an hour. However, Gurobi still 
does not work.

If I run

s = MixedIntegerLinearProgram(solver='Gurobi')

then I get "No module named gurobi_backend"

Since running make takes such a long time, I am not keen on the 
trial-and-error approach to solving this. Does anyone has tested and 
reliable instructions?

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/afa21eff-c1d1-47eb-b970-d1a6829b7e7c%40googlegroups.com.


Re: [sage-support] Re: Tracking memory usage and time

2019-09-03 Thread J
On 19-09-03 09:43:23, Jori Mäntysalo (TAU) wrote:
> On Mon, 2 Sep 2019, J wrote:
>
> > Thanks get_memory_usage sounds good; I want to run several decoders from
> > the coding theory module to see better show there ups and downs;
>
> There is also at least %mprun magic. Googling that will give you some
> examples.
>
Thank you, I will research this too

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/20190903111334.xwsd2v63vlyl5jwc%40deathbolt.927589452.space.


Re: [sage-support] Re: Tracking memory usage and time

2019-09-03 Thread TAU
On Mon, 2 Sep 2019, J wrote:

> Thanks get_memory_usage sounds good; I want to run several decoders from
> the coding theory module to see better show there ups and downs;

There is also at least %mprun magic. Googling that will give you some 
examples.

-- 
Jori Mäntysalo

Tampereen yliopisto - Ihminen ratkaisee

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/alpine.DEB.2.21..1909031237550.45316%40shell.sis.uta.fi.


Re: [sage-support] Re: Cannot load session create in another version of sage

2019-09-03 Thread Vincent Delecroix




Le 03/09/2019 à 11:28, Simon King a écrit :

Hi Vincent,

On 2019-09-03, Vincent Delecroix <20100.delecr...@gmail.com> wrote:

I believe a CAS which doesn't even *attempt* to offer a way to store user
data permanently and reliably is a failure. I'll rant more on it on the
ticket.


I strongly agree that this is a needed feature! But, I was told on the
ticket that pickling is not the way to do it... I am not Python expert
enough to judge this.


Then I misunderstood. By your comment on the ticket, you found that
Python actually states that the pickle protocol IS supposed to be
compatible.


compatible up to pickling protocol versions and datastructure changes
between Python2 and Python3. See also the related Julien Puydt answer
on sage-devel.


In fact it isn't compatible, but that of course means it must be
attempted to make it compatible.


It is already compatible. You just need to specify which kind of
data has been pickled ('bytes' vs 'str') and which protocol to use
(at pickling and unpickling time).

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/ea5fc0db-002a-5847-54de-9ed4a492658a%40gmail.com.


[sage-support] Re: Cannot load session create in another version of sage

2019-09-03 Thread Simon King
Hi Vincent,

On 2019-09-03, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
>> I believe a CAS which doesn't even *attempt* to offer a way to store user
>> data permanently and reliably is a failure. I'll rant more on it on the
>> ticket.
>
> I strongly agree that this is a needed feature! But, I was told on the
> ticket that pickling is not the way to do it... I am not Python expert
> enough to judge this.

Then I misunderstood. By your comment on the ticket, you found that
Python actually states that the pickle protocol IS supposed to be
compatible.

In fact it isn't compatible, but that of course means it must be
attempted to make it compatible.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/qklbo7%24561i%241%40blaine.gmane.org.


Re: [sage-support] Re: Cannot load session create in another version of sage

2019-09-03 Thread Vincent Delecroix

Le 03/09/2019 à 09:07, Simon King a écrit :

Hi Vincent,

On 2019-09-03, Vincent Delecroix <20100.delecr...@gmail.com> wrote:

If I understand correctly, saving/loading individual objects is supposed to
be backwards compatible.


This is not correct. Saving individual object is not supposed to
be backward compatible. See

https://trac.sagemath.org/ticket/28302


Thank you for the pointer.

I believe a CAS which doesn't even *attempt* to offer a way to store user
data permanently and reliably is a failure. I'll rant more on it on the
ticket.


I strongly agree that this is a needed feature! But, I was told on the
ticket that pickling is not the way to do it... I am not Python expert
enough to judge this.

Vincent

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/36286bf2-abb0-2092-0db1-502502946038%40gmail.com.


[sage-support] Re: Cannot load session create in another version of sage

2019-09-03 Thread Simon King
Hi Vincent,

On 2019-09-03, Vincent Delecroix <20100.delecr...@gmail.com> wrote:
>> If I understand correctly, saving/loading individual objects is supposed to
>> be backwards compatible.
>
> This is not correct. Saving individual object is not supposed to
> be backward compatible. See
>
> https://trac.sagemath.org/ticket/28302

Thank you for the pointer.

I believe a CAS which doesn't even *attempt* to offer a way to store user
data permanently and reliably is a failure. I'll rant more on it on the
ticket.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/qkl3fl%243eaj%241%40blaine.gmane.org.