Skip to content

nucci6/numpy-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

NumPy Testing for the RISE SW Stack

A successful execution of the following tests will verify the installation and optimization of NumPy on the new RISE software stack.

Two Python scripts are provided for testing:

  • numpy_test1.py - Runs the official, exhaustive NumPy test suite.
  • numpy_test2.py - Runs a quick sanity check on core components.

Step 1: Environment Setup

For either test, we must first set up the environment by loading the appropriate modules and creating a virtual environment. The virtual environment is required to install testing dependencies without needing write access to the central software stack.

1. Load the required modules:

# Clear existing modules
module purge

# Load the RISE software stack and NumPy
module use /storage/icds/sw8/modulefiles_rc2026/linux-rhel8-x86_64/Core
module load gcc
module load py-numpy

(Note: You can use module spider numpy to verify available versions if needed).

  1. Create and activate a virtual environment: The --system-site-packages flag is critical here, as it allows the virtual environment to see the central NumPy installation.
python -m venv --system-site-packages ~/numpy_test_env
source ~/numpy_test_env/bin/activate
  1. Install testing dependencies:
pip install pytest hypothesis setuptools meson

Step 2: Run the Full Test Suite (numpy_test1.py)

The most thorough way to test a NumPy installation is to run its own built-in test suite. This ensures that all C-extensions, linear algebra libraries (BLAS/LAPACK), and core functions are working correctly on our specific hardware architecture.

Run the test script:

python numpy_test1.py 

Expected Output: The test will take a few minutes to run thousands of checks. The output should look like this near the end (exact numbers may vary slightly):

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
37065 passed, 987 skipped, 1305 deselected, 30 xfailed, 4 xpassed, 18 warnings in 149.49s (0:02:29)

Step 3: Run the Core Sanity Check (numpy_test2.py)

This second test is not as comprehensive, but runs a reasonable subset to quickly verify that the core components (array creation, broadcasting, random number generation, and C-compiled linear algebra) are functioning and highly optimized.

Run the test script:

python numpy_test2.py 

Expected Output:

--- NumPy Sanity Check ---
Version: 1.26.4

1. Testing array creation and broadcasting...
   -> Array math OK
2. Testing random number generation...
   -> Generated 500x500 random matrix. Mean: 0.5003 (Expected ~0.5)
3. Testing Linear Algebra (Matrix Multiplication & Eigenvalues)...
   -> LinAlg operations completed in 0.0736 seconds
   -> Max eigenvalue: 62667.0781

 NumPy 1.26.4 is installed and functioning correctly!

Step 4: Cleanup

Once testing is complete, you can deactivate and remove the virtual environment to keep your home directory clean:

deactivate
rm -rf ~/numpy_test_env

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages