-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38a61aa
commit b3b7c2b
Showing
3 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
# Check if the accelerator argument is provided | ||
if [ -z "$1" ]; then | ||
echo "Usage: $0 <accelerator>" | ||
echo "Available options for <accelerator>: tpu, gpu, cpu" | ||
exit 1 | ||
fi | ||
|
||
ACCELERATOR=$1 | ||
|
||
# Activate Conda | ||
source ~/miniconda3/etc/profile.d/conda.sh | ||
|
||
# Create a new Conda environment | ||
conda create -n stx python=3.10 -y | ||
|
||
# Activate the environment | ||
conda activate stx | ||
|
||
# Install packages with pip | ||
pip install -e . | ||
|
||
# Install JAX with the appropriate accelerator support | ||
if [ "$ACCELERATOR" == "tpu" ]; then | ||
pip install -U "jax[tpu]" -f https://storage.googleapis.com/jax-releases/libtpu_releases.html | ||
elif [ "$ACCELERATOR" == "gpu" ]; then | ||
pip install -U "jax[cuda]" -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html | ||
elif [ "$ACCELERATOR" == "cpu" ]; then | ||
pip install -U jax | ||
else | ||
echo "Invalid accelerator type: $ACCELERATOR" | ||
echo "Available options: tpu, gpu, cpu" | ||
exit 1 | ||
fi | ||
|
||
echo "Installation complete with $ACCELERATOR support." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Exit immediately if a command exits with a non-zero status | ||
set -e | ||
|
||
# Step 1: Download Miniconda | ||
CONDA_INSTALLER="Miniconda3-latest-Linux-x86_64.sh" | ||
CONDA_URL="https://repo.anaconda.com/miniconda/$CONDA_INSTALLER" | ||
|
||
echo "Downloading Miniconda installer..." | ||
if ! wget -q --show-progress "$CONDA_URL"; then | ||
echo "Error: Failed to download Miniconda installer." | ||
exit 1 | ||
fi | ||
|
||
# Step 2: Install Miniconda (silently with default settings) | ||
echo "Installing Miniconda..." | ||
bash "$CONDA_INSTALLER" -b | ||
|
||
# Clean up the installer after installation | ||
rm -f "$CONDA_INSTALLER" | ||
|
||
# Step 3: Initialize Conda (Assuming bash shell) | ||
CONDA_PATH="$HOME/miniconda3" | ||
|
||
# Ensure Conda is initialized on every new shell | ||
if ! grep -q "source $CONDA_PATH/etc/profile.d/conda.sh" ~/.bashrc; then | ||
echo "source $CONDA_PATH/etc/profile.d/conda.sh" >> ~/.bashrc | ||
echo "Conda initialization added to .bashrc" | ||
fi | ||
|
||
# Apply the .bashrc changes to the current shell session | ||
echo "Initializing Conda for the current shell..." | ||
source "$CONDA_PATH/etc/profile.d/conda.sh" | ||
|
||
echo "Miniconda installation and initialization complete." | ||
|
||
# Optional: Update conda to the latest version | ||
echo "Updating Conda to the latest version..." | ||
conda update -n base -c defaults conda -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters