Skip to content

Commit

Permalink
chrono to avoid seed in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ameli committed Dec 18, 2023
1 parent e0898a4 commit 3ad48de
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 32 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check-manifest.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: "Check Manifest"

on:
# push:
# branches:
# - main
push:
branches:
- main
release:
types: [published]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-conda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ jobs:
CIBW_ENVIRONMENT: "USE_LONG_INT=0 USE_UNSIGNED_LONG_INT=0 USE_CBLAS=0 USE_CUDA=1 CUDA_DYNAMIC_LOADING=1 CUDA_HOME=/usr/local/cuda"
with:
output-dir: wheelhouse

# Upload all wheels to an artifact
- name: Upload artifacts
uses: actions/upload-artifact@v3
Expand Down
20 changes: 10 additions & 10 deletions docs/doxygen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
$env:CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"

``USE_CUDA``

Expand All @@ -341,7 +341,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export USE_CUDA = "1"
$env:USE_CUDA = "1"

``CUDA_DYNAMIC_LOADING``

Expand All @@ -361,7 +361,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CUDA_DYNAMIC_LOADING = "1"
$env:CUDA_DYNAMIC_LOADING = "1"

``CYTHON_BUILD_IN_SOURCE``

Expand All @@ -381,7 +381,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CYTHON_BUILD_IN_SOURCE = "1"
$env:CYTHON_BUILD_IN_SOURCE = "1"

.. hint::

Expand All @@ -405,7 +405,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CYTHON_BUILD_FOR_DOC = "1"
$env:CYTHON_BUILD_FOR_DOC = "1"

.. warning::

Expand Down Expand Up @@ -433,7 +433,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export USE_CBLAS = "1"
$env:USE_CBLAS = "1"

``DEBUG_MODE``

Expand All @@ -453,7 +453,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export DEBUG_MODE = "1"
$env:DEBUG_MODE = "1"

.. attention::

Expand Down Expand Up @@ -503,9 +503,9 @@ If you are using ``sudo`` for the above command, add ``-E`` option to ``sudo`` t
.. code-block:: PowerShell
:emphasize-lines: 5

$env:export CUDA_HOME = "/usr/local/cuda"
$env:export USE_CUDA = "1"
$env:export CUDA_DYNAMIC_LOADING = "1"
$env:CUDA_HOME = "/usr/local/cuda"
$env:USE_CUDA = "1"
$env:CUDA_DYNAMIC_LOADING = "1"

sudo -E python setup.py install

Expand Down
20 changes: 10 additions & 10 deletions docs/source/install/compile_source.rst
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"
$env:CUDA_HOME = "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7"

``USE_CUDA``

Expand All @@ -354,7 +354,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export USE_CUDA = "1"
$env:USE_CUDA = "1"

``CUDA_DYNAMIC_LOADING``

Expand All @@ -374,7 +374,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CUDA_DYNAMIC_LOADING = "1"
$env:CUDA_DYNAMIC_LOADING = "1"

``CYTHON_BUILD_IN_SOURCE``

Expand All @@ -394,7 +394,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CYTHON_BUILD_IN_SOURCE = "1"
$env:CYTHON_BUILD_IN_SOURCE = "1"

.. hint::

Expand All @@ -418,7 +418,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export CYTHON_BUILD_FOR_DOC = "1"
$env:CYTHON_BUILD_FOR_DOC = "1"

.. warning::

Expand Down Expand Up @@ -446,7 +446,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export USE_CBLAS = "1"
$env:USE_CBLAS = "1"

``DEBUG_MODE``

Expand All @@ -466,7 +466,7 @@ Set the following environment variables as desired to configure the compilation

.. prompt:: powershell

$env:export DEBUG_MODE = "1"
$env:DEBUG_MODE = "1"

.. attention::

Expand Down Expand Up @@ -516,9 +516,9 @@ If you are using ``sudo`` for the above command, add ``-E`` option to ``sudo`` t
.. code-block:: PowerShell
:emphasize-lines: 5
$env:export CUDA_HOME = "/usr/local/cuda"
$env:export USE_CUDA = "1"
$env:export CUDA_DYNAMIC_LOADING = "1"
$env:CUDA_HOME = "/usr/local/cuda"
$env:USE_CUDA = "1"
$env:CUDA_DYNAMIC_LOADING = "1"
sudo -E python -m pip install .
Expand Down
4 changes: 2 additions & 2 deletions docs/source/install/gen_documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ Set ``CYTHON_BUILD_FOR_DOC`` to `1` (see :ref:`Configure Compile-Time Environmen

.. prompt:: powershell

$env:export CYTHON_BUILD_FOR_DOC = "1"
$env:export USE_CUDA = "0"
$env:CYTHON_BUILD_FOR_DOC = "1"
$env:USE_CUDA = "0"
sudo -E python setup.py install

Generate Sphinx Documentation
Expand Down
2 changes: 1 addition & 1 deletion docs/source/performance/gpu.rst
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Beyond Extreme Array Sizes

.. prompt:: powershell

$env:export UNSIGNED_LONG_INT = "1"
$env:UNSIGNED_LONG_INT = "1"

Then, recompile |project|. See :ref:`Compile from Source <compile-source>`.

Expand Down
2 changes: 1 addition & 1 deletion imate/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.22.0"
__version__ = "0.22.1"
14 changes: 12 additions & 2 deletions imate/_random_generator/split_mix_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,18 @@ SplitMix64::SplitMix64()
// make it differ between each milliseconds, the std::clock is added, which
// is the cpu time (in POSIX) or wall time (in windows) and in the unit of
// system's clocks per second.
uint64_t seed = static_cast<uint64_t>(std::time(0)) +
static_cast<uint64_t>(std::clock());
// uint64_t seed = static_cast<uint64_t>(std::time(0)) +
// static_cast<uint64_t>(std::clock());

// Using the highest resolution clock, since we want to have distinct seed
// values if this function is called subsequently.
// std::chrono::high_resolution_clock::time_point current_time = \
std::chrono::high_resolution_clock::now();

// Cast time point to 64-bit integer
uint64_t seed = static_cast<uint64_t>(
std::chrono::duration_cast<std::chrono::nanoseconds>(
current_time.time_since_epoch()).count());

// Seeding as follow only fills the first 32 bits of the 64-bit integer.
// Repeat the first 32 bits on the second 32-bits to create a better 64-bit
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,8 @@ def install_package(package):
export CUDA_DYNAMIC_LOADING=1
# In Windows
$env:export CYTHON_BUILD_IN_SOURCE = "1"
$env:export CYTHON_BUILD_FOR_DOC = "1"
$env:CYTHON_BUILD_IN_SOURCE = "1"
$env:CYTHON_BUILD_FOR_DOC = "1"
$env:USE_CBLAS = "0"
$env:USE_CUDA = "1"
$env:DEBUG_MODE = "1"
Expand Down

0 comments on commit 3ad48de

Please sign in to comment.