By the way, does anyone knows why
src/sage/lfunctions/zero_sums.pyx has it's own ncpus() defined, as
well as a global cdef NCPUS.

This looks like there was more code that was replaced by
sage.parallel.ncpus.ncpus in a very light-touch way.


On Tue, Mar 11, 2025 at 7:40 PM John H Palmieri <jhpalmier...@gmail.com> wrote:
>
> I see this too (I'm using OS X, don't know the situation for other 
> platforms). I think the problem is somehow with Python3. If I modify the 
> src/bin/sage-env script (which is where SAGE_NUM_THREADS gets read and 
> perhaps modified) to directly run the script sage-num-threads.py, I get an 
> error, and that error means that sage-env uses the default value of "1" for 
> SAGE_NUM_THREADS.
>
> I applied this change:
>
> diff --git a/src/bin/sage-env b/src/bin/sage-env
> index 5a53ab1d2c..3000b4d983 100644
> --- a/src/bin/sage-env
> +++ b/src/bin/sage-env
> @@ -580,6 +580,9 @@ case "$SAGE_NUM_THREADS,$SAGE_NUM_THREADS_PARALLEL" in
>          # First, figure out the right values for SAGE_NUM_THREADS (default
>          # number of threads) and SAGE_NUM_THREADS_PARALLEL (default number of
>          # threads when parallel execution is asked explicitly).
> +
> +        sage-num-threads.py
> +
>          sage_num_threads_array=$(sage-num-threads.py 2>/dev/null || echo 1 2 
> 1)
>          sage_num_threads_array="${sage_num_threads_array% *}" # strip third 
> item
>          SAGE_NUM_THREADS="${sage_num_threads_array% *}" # keep first item
>
> If I run "sage" or "sage -sh", I see
>
> /Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.12/bin/sage-num-threads.py:4:
>  DeprecationWarning: pkg_resources is deprecated as an API. See 
> https://setuptools.pypa.io/en/latest/pkg_resources.html
>   __import__('pkg_resources').require('sagemath-standard==10.6b8')
> Traceback (most recent call last):
>   File 
> "/Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pkg_resources/__init__.py",
>  line 656, in _build_master
>     ws.require(__requires__)
>   File 
> "/Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pkg_resources/__init__.py",
>  line 1063, in require
>     needed = self.resolve(parse_requirements(requirements))
>              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>   File 
> "/Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pkg_resources/__init__.py",
>  line 890, in resolve
>     dist = self._resolve_dist(
>            ^^^^^^^^^^^^^^^^^^^
>   File 
> "/Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages/pkg_resources/__init__.py",
>  line 936, in _resolve_dist
>     raise VersionConflict(dist, req).with_context(dependent_req)
> pkg_resources.ContextualVersionConflict: (sphinxcontrib-htmlhelp 2.0.5 
> (/Users/palmieri/Sage/git/sage/local/var/lib/sage/venv-python3.12/lib/python3.12/site-packages),
>  Requirement.parse('sphinxcontrib-htmlhelp>=2.0.6'), {'sphinx'})
>
> Sage provides sphinxcontrib-htmlhelp 2.0.5. I don't know what's looking for 
> 2.0.6; I got no hits when I ran 'git grep "2[.]0[.]6" '.
>
> On Tuesday, March 11, 2025 at 4:13:41 PM UTC-7 enriqu...@gmail.com wrote:
>>
>>
>> For 10.5 with python 3.12.5, sage.parallel.ncpus.ncpus() is 1 without giving 
>> a value to SAGE_NUM_THREADS and 16 if sage is opened as "SAGE_NUM_THREADS=16 
>> sage". For 10.6.beta9 (python 3.13.2), the value is always one; in another 
>> computer 10.6.beta9 is using python 3.12.5 and the value is always one.
>> El miércoles, 12 de marzo de 2025 a las 6:15:27 UTC+9, dim...@gmail.com 
>> escribió:
>>>
>>> On Mon, Mar 10, 2025 at 4:28 AM enriqu...@gmail.com
>>> <enriqu...@gmail.com> wrote:
>>> >
>>> > If I set the variable SAGE_NUM_THREADS to a number of cores before 
>>> > opening a sage session (command line or jupyterlab) there is a different 
>>> > behaviour in 10.5 and in 10.6beta;
>>> > parallel computation can be done in 10.5, there is no effect in the beta 
>>> > version (I do not know when it started to fail). In the beta version 
>>> > parallel computation is possible declaring the number of cores using the 
>>> > following hack (suggested to me at some point by Miguel Marco)
>>> > def miscpus():
>>> > return "put here the number of cores"
>>> > sage.parallel.ncpus.ncpus=miscpus
>>> > Is it possible to know when SAGE_NUM_THREADS lost its effects?
>>>
>>> what is the output of sage.parallel.ncpus.ncpus() in 10.5 and in
>>> 10.6.beta* for you?
>>> (without using the hack above). Are they using the same Python version?
>>>
>>> The code for sage.parallel.ncpus.ncpus didn't change for a year, since 10.3.
>>>
>>> Dima
>>>
>>>
>>>
>>>
>>> > Thanks, Enrique.
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google Groups 
>>> > "sage-devel" group.
>>> > To unsubscribe from this group and stop receiving emails from it, send an 
>>> > email to sage-devel+...@googlegroups.com.
>>> > To view this discussion visit 
>>> > https://groups.google.com/d/msgid/sage-devel/fe02ae5f-64ab-4fb5-a826-d97f3d418dccn%40googlegroups.com.
>
> --
> You received this message because you are subscribed to the Google Groups 
> "sage-devel" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sage-devel+unsubscr...@googlegroups.com.
> To view this discussion visit 
> https://groups.google.com/d/msgid/sage-devel/5f4e3fd4-d49d-44e8-9864-d0e027d61546n%40googlegroups.com.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq2J%3DFiehHYh%2BBQQJgqTbQvx4zae%2BGQFT27%3DV8b8DaFvXg%40mail.gmail.com.

Reply via email to