examples
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
examples [2025/03/31 22:00] – nshegunov | examples [2025/03/31 22:28] (current) – nshegunov | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | === PyTorch | + | ====MPI4PI==== |
+ | TOD | ||
+ | |||
+ | ---- | ||
+ | ==== PyTorch==== | ||
Consider the following simple python test script( " | Consider the following simple python test script( " | ||
Line 46: | Line 50: | ||
</ | </ | ||
+ | ---- | ||
+ | ====Pandas==== | ||
+ | Consider the following simple python test script( “pandas_test.py”): | ||
+ | <code python> | ||
+ | import pandas as pd | ||
+ | import numpy as np | ||
+ | # Create a simple DataFrame | ||
+ | data = { | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | } | ||
+ | df = pd.DataFrame(data) | ||
+ | print(" | ||
+ | print(df) | ||
+ | |||
+ | # Test basic operations | ||
+ | print(" | ||
+ | print(df.sum()) | ||
+ | |||
+ | print(" | ||
+ | print(df.mean()) | ||
+ | |||
+ | # Adding a new column | ||
+ | df[' | ||
+ | print(" | ||
+ | print(df) | ||
+ | |||
+ | # Filtering rows | ||
+ | filtered_df = df[df[' | ||
+ | print(" | ||
+ | print(filtered_df) | ||
+ | |||
+ | # Check if NaN values exist | ||
+ | print(" | ||
+ | print(df.isna().sum()) | ||
+ | </ | ||
+ | |||
+ | You can use the following snatch script to run it: | ||
+ | <code bash> | ||
+ | #!/bin/bash | ||
+ | #SBATCH --job-name=pytorch_test | ||
+ | #SBATCH --output=pytorch_test.out | ||
+ | #SBATCH --error=pytorch_test.err | ||
+ | #SBATCH --time=00: | ||
+ | #SBATCH --partition=a40 | ||
+ | #SBATCH --gres=gpu: | ||
+ | #SBATCH --mem=4G | ||
+ | #SBATCH --cpus-per-task=2 | ||
+ | |||
+ | # Load necessary modules (modify based on your system) | ||
+ | module load python/ | ||
+ | module load python/ | ||
+ | |||
+ | # Activate your virtual environment if needed | ||
+ | # source ~/ | ||
+ | |||
+ | # Run the PyTorch script | ||
+ | python3.13 pandas_test.py | ||
+ | </ | ||
+ | ---- | ||
+ | ====Other popular==== | ||
+ | TOD |
examples.1743458414.txt.gz · Last modified: 2025/03/31 22:00 by nshegunov