Skip to content

Commit

Permalink
Merge pull request #45 from lowderchris/develop
Browse files Browse the repository at this point in the history
Merging develop into main
  • Loading branch information
lowderchris authored Feb 28, 2024
2 parents a23037a + f7b68a7 commit eeb9052
Show file tree
Hide file tree
Showing 85 changed files with 10,126 additions and 3,406 deletions.
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,19 @@
*.gcda
*.gcno
*.png
*.pyc
*.json
cover_db/

#the local sandbox build
sandbox/

#any Inline stuff
_Inline/

#fluxpipe related files
include/flux/
blib/
data/
local/
perltidy.ERR
16 changes: 14 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export FL_PREFIX

everything: libbuild install

install: libinstall pdlbuild pdltest pdlinstall
install: libinstall pdlbuild pdltest pdlinstall install_fluxpipe

libbuild:
/bin/sh -c 'cd lib; FL_PREFIX=$(FL_PREFIX) make';
Expand All @@ -30,9 +30,15 @@ pdltest:
pdlinstall:
/bin/sh -c 'cd pdl; make install;';

install_fluxpipe:
@cd fluxpipe/ && make install_fluxpipe;

uninstall_fluxpipe:
@cd fluxpipe/ && make uninstall_fluxpipe;

clean:
rm -f *~ \#* ; \
rm -f pdl/*.png; \
cd lib; \
make clean; \
cd ..; \
Expand All @@ -44,4 +50,10 @@ realclean: clean
rm -rf sandbox

uninstall:
rm -r $(FL_PREFIX)/lib/libflux.a $(FL_PREFIX)/include/flux ;
@echo "\nUninstalling FLUX...";
@-rm -rf $(FL_PREFIX)/lib/libflux.a || true;
@-rm -rf $(FL_PREFIX)/include/flux || true;
@echo "\tFlux uninstall complete.\n";

@cd fluxpipe/ && make uninstall_fluxpipe;

4 changes: 4 additions & 0 deletions doc/README
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ here for a future release. The original design docs are kept in "old"
for historical reasons.

-CED 31-Oct-2007

Please see the other files in this directory for some basic documentation.
The above link is to the wiki, which does not yet contain information about FLUXpipe.

157 changes: 157 additions & 0 deletions doc/mac_install_gilly.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
# Macintosh Installation

Here's the path to installing FLUX. Best to run everything as Admin if possible.
All of these commands should be typed into the terminal.
If you don't use zsh, you'll need to substitute the shell you use.

## Makefile Installation -----------------------------------

The whole installation process is being integrated into the makefile. See install_flux.sh.

#### 1. If you don't have python installed, get anaconda:

- Download and run the installer from [https://www.anaconda.com/products/individual](https://www.anaconda.com/products/individual)

#### 2. If you don't have perl installed, get perlbrew:

- check ``which perl`` to see if you have perl
- if not, follow the manual installation instructions under the perl section, below. Don't worry about the cpanminus part.

#### 3. Put the PL and FL_PREFIX paths into /fluxpipe/PREFIX_PATHS.sh

Examples:
``PL_PATH="/Users/cgilbert/perl5/perlbrew/perls/perl-5.32.0"``
``FL_PATH="/Users/cgilbert/vscode/fluxons/fluxon-mhd"``

#### 4. Build and Run the Makefile

* Go to the fluxpipe directory
``cd fluxon-mhd/fluxpipe``
* Build the makefile
``perl Makefile.PL``
* Return to the main directory
``cd ..``
* Run the top-level make command
``make everything``

Good job! Flux and Fluxpipe should both be working now.

## Manual Installation --------------------------------------

This is already depricated because all of these steps have been moved into the makefile

#### Install Homebrew and Packages: ([https://brew.sh/](https://brew.sh/))) ---------------

- **To get Homebrew, use:**
``% /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"``
- **Install packages**
``% brew install gnuplot``
``% brew install fftw``

#### Install Perl -------------------------------------------

- **Get perlbrew (recommended, [https://perlbrew.pl/](https://perlbrew.pl/))**
``% \curl -L https://install.perlbrew.pl | bash``
- **Install the latest version of perl**
``% perlbrew install perl-5.36.1``
- **Set the system perl to this version**
``% perlbrew switch perl-5.36.1``
- **Install cpanminus, the perl package manager**
``% curl -L https://cpanmin.us | perl - --sudo App::cpanminus``
**~ OR ~**
``% cpan App::cpanminus``

#### Install Python ---------------------------------------

- **If you don't have python installed, start by installing anaconda:**

- Download the installer from [https://www.anaconda.com/products/individual](https://www.anaconda.com/products/individual)
- Run the installer
- **Prepare the Environment:**

- initialize conda (once ever)
``% conda init zsh``
- restart your terminal (after init)
``% source ~/.zshrc`` ~ OR ~ %``zsh``
- make a new environment using conda and activate it
``conda create -n fluxenv``
``conda activate fluxenv``
- If you are using an Apple Silicon M1/M2 architecture, please see the footnotes.
- navigate to the fluxpipe directory and
install the package by running
``pip install -e .``

#### Set the environment variables ---------------------

* **Set the two prefixes**
``export FL_PREFIX='_absolute/_path/_to/fluxon-mhd' ``
``export PL_PREFIX=_absolute/_path/_to/perl ``

* example: ``export FL_PREFIX=$HOME/vscode/fluxons/fluxon-mhd ``
example: ``export PL_PREFIX=/$HOME/perl5/perlbrew/perls/perl-5.32.0 ``
* **Add them to your environment permanently by running the following commands:**
``echo 'export PL_PREFIX='$PL_PREFIX >> ~/.zshrc ``
``echo 'export FL_PREFIX='$FL_PREFIX >> ~/.zshrc ``
* **make it so zshenv calls zshrc**
``grep -qF "source ~/.zshrc" ~/.zshenv || echo "source ~/.zshrc" >> ~/.zshenv``

#### Install PDL and other dependencies --------------

- **Install PDL and its dependencies**
- Go to Perl directory
``% cd $PL_PREFIX ``
- Install PDL
``% cpanm PDL ``
- Configure 'local::lib' to set the local build path (leave this as-is).
``% PERL_MM_OPT="INSTALL_BASE=$PL_PREFIX/lib/perl5"``
``% cpanm local::lib ``
``% echo 'eval "$(perl -I$PL_PREFIX/lib/perl5/lib/perl5 -Mlocal::lib=$PL_PREFIX/lib/perl5)"' >> ~/.zshrc ``
- **Install other dependencies of the project**
``% cpanm File::ShareDir ``
``% cpanm PDL::Graphics::Gnuplot ``
``% cpanm Math::RungeKutta ``
and others...

#### Install FLUX -----------------------------------------

- **Get Flux**
``% cd $FL_PREFIX/.. ``
``% git clone https://github.com/lowderchris/fluxon-mhd.git ``
- **Compile Flux**
``% cd $FL_PREFIX ``
``% sudo make everything ``

### Install FLUXpipe -------------------------------

- Install the fluxpipe pdl package locally
``% cd $FL_PREFIX/fluxpipe ``
``% cpanm --installdeps . ``
``% cpanm --notest --local-lib=local/ .``
- Set the perl path to the local build and reload the terminal
``echo 'export PERL5LIB=$FL_PREFIX/fluxpipe/local/lib/perl5:$PERL5LIB' >> ~/.zshrc ``
``source ~/.zshrc``
- - Unfortunately this build must be recompiled after every change. To do this, run
``cd $FL_PREFIX/fluxpipe ``
``cpanm --notest --local-lib=local/ .``
- This can be configured to happen automatically in VSCode. You'll need the File Watcher extension.
If you place the following lines in your settings.json file in vscode, it will keep your pdl build up to date whenever you save a file.

``"filewatcher.commands": [ { "match": ".*\\.(pdl|pm|json)$", "isAsync": true, "event": "onFileChange", "cmd": "cd $FL_PREFIX/fluxpipe && cpanm --notest --local-lib=local/ . && echo $(date) " } ],``

### Footnotes --------------------------------------

[1] Functions to Create Conda Envs for Specific Architectures

**Create x86 conda environment**
``echo 'conda_create_x86 () { CONDA_SUBDIR=osx-64 conda create -n $@; conda activate $1; }' >> ~/.zshrc``

**Create ARM conda environment**
``echo 'conda_create_ARM () { CONDA_SUBDIR=osx-arm64 conda create -n $@; conda activate $1; }' >> ~/.zshrc ``

**Run any command with a specified architecture**
``arch -arm64 <command> <args>``

examples:
``conda_create_ARM myenv_ARM python=3.9``
``conda_create_x86 myenv_x86 python=3.9``
``arch -arm64 brew install qemu``
24 changes: 24 additions & 0 deletions fluxpipe/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
*~
\#*
.DS_Store

#test-coverage-related files & dirs
*.gcov
*.gcda
*.gcno
*.png
*.pyc
*.json
cover_db/

#the local sandbox build
sandbox/

#any Inline stuff
_Inline/

include/flux/
fluxpipe.egg-info
blib/
data/
local/
Loading

0 comments on commit eeb9052

Please sign in to comment.