Skip to content

Commit

Permalink
update amica
Browse files Browse the repository at this point in the history
  • Loading branch information
dungscout96 committed Jul 25, 2024
1 parent 1a42c54 commit 11c59e4
Show file tree
Hide file tree
Showing 44 changed files with 1,794 additions and 101 deletions.
8 changes: 8 additions & 0 deletions code/plugins/reformat_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ def reformat_plugin_dir(plugin_input_dir, plugin_name, order, plugin_type='wiki'
for file in files:
if file.endswith('.jpg') or file.endswith('.png'):
shutil.copyfile(os.path.join(root, file), os.path.join(plugin_output_dir, file))

# if plugin is 'imat', copy the Docs directory recursively to the output directory
if plugin_name == 'imat':
shutil.copytree(os.path.join(plugin_input_dir, 'Docs'), os.path.join(plugin_output_dir, 'Docs'), dirs_exist_ok=True)
Expand All @@ -57,6 +58,13 @@ def reformat_plugin_dir(plugin_input_dir, plugin_name, order, plugin_type='wiki'

if plugin_type == 'wiki':
wiki_plugin_input_dir = plugin_input_dir + '.wiki'

# copy all .jpg and .png files from wiki input to output dir
for root, dirs, files in os.walk(wiki_plugin_input_dir):
for file in files:
if file.endswith('.jpg') or file.endswith('.png'):
shutil.copyfile(os.path.join(root, file), os.path.join(plugin_output_dir, file))

for root, dirs, files in os.walk(wiki_plugin_input_dir):
for file in files:
if file.endswith('.md') and not file.startswith('index') and not file.startswith('Home'):
Expand Down
4 changes: 2 additions & 2 deletions code/plugins/update_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ def update_repo(repo, order, plugin_type='readme'):
# if 'github' not in current directory, create it
if not os.path.exists('github'):
os.makedirs('github')
wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata']
readme_plugins = ['ARfitStudio', 'roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'amica', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline','NIMA', 'firfilt']
wiki_plugins = ['SIFT', 'get_chanlocs', 'NFT', 'PACT', 'nsgportal', 'clean_rawdata', 'amica']
readme_plugins = ['ARfitStudio', 'roiconnect', 'EEG-BIDS', 'trimOutlier', 'groupSIFT', 'nwbio', 'ICLabel', 'dipfit', 'eegstats', 'PowPowCAT', 'PACTools', 'zapline-plus', 'fMRIb', 'relica', 'std_dipoleDensity', 'imat', 'viewprops', 'cleanline','NIMA', 'firfilt']
ordering = ['ICLabel', 'dipfit', 'EEG-BIDS', 'roiconnect', 'amica', 'cleanline', 'clean_rawdata', 'SIFT', 'zapline-plus', 'eegstats', 'trimOutlier', 'fMRIb', 'imat', 'nwbio', 'NIMA', 'PACT', 'NFT', 'PACTools', 'ARfitStudio', 'PowPowCAT', 'relica', 'std_dipoleDensity', 'viewprops', 'firfilt', 'groupSIFT', 'get_chanlocs', 'nsgportal']

if len(sys.argv) == 1:
Expand Down
103 changes: 103 additions & 0 deletions plugins/amica/AMICA-Compilation-instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
layout: default
title: AMICA-Compilation-instructions
long_title: AMICA-Compilation-instructions
parent: amica
grand_parent: Plugins
---
# How to compile with Intel Fortran on Windows

1. Install Intel OneAPI Base Toolkit for Windows.
2. Install Intel OneAPI HPC Toolkit for Windows.
3. Open Intel OneAPI command window (in Start menu, 32 or 64 bit as appropriate). Change to directory with Amica code, and compile Amica with the command (/F sets the stack size):

> mpif90 /Qopenmp /Qmkl /F2147483648 /DMKL /fpp /O3 /exe:amica15mkl.exe funmod2.f90 amica15.f90

4. Test:

> .\amica15mkl.exe .\amicadefs.param

5. The files impi.dll and libfabric.dll should be copied to executable folder when running outside OneAPI command window. Search OneAPI mpi directory for locations.


# THow to compile with Intel Fortran on Mac

0. These are old instructions. Try using Intel OneAPI modifiying the commands similar to the instructions for Windows above.
1. Install Intel Fortran compiler for Mac/Linux (free demo).
See https://software.intel.com/en-us/intel-parallel-studio-xe

2. Compile MPICH2 setting environmental vars CC, CXX, FC, and F77 to icc and ifort. Set $FBIN to Intel Fortran bin directory.

i) Download the mpich-3.2 code from: http://www.mpich.org/static/downloads/3.2/mpich-3.2.tar.gz

ii) Compile mpich-3.2:

$ cp /Users/$USER/downloads/mpich-3.2.tar.gz .
$ setenv CC $FBIN/icc
$ setenv CXX $FBIN/icc
$ setenv F77 $FBIN/ifort
$ setenv FC $FBIN/ifort
$ tar xvf mpich-3.2.tar.gz
$ cd mpich-3.2
$ ./configure --prefix=/Users/$USER/mpich-3.2-install
$ make
$ make install

3. Compile Amica with the command:

$ ~/mpich-3.2-install/bin/mpif90 -L/Users/$USER/mpich-3.2-install/lib/ -I/Users/$USER/mpich-3.2-install/include/ -qopenmp -mkl -static-intel -O3 -fpp -DMKL amica15.f90 funmod2.f90 -o amica15mac

4. Test:

i) Download Sample EEG Data (Memorize.fdt and amicadefs.param) from: https://sccn.ucsd.edu/~jason/amica_web.html

ii) Test binary:

$ ./amica15mac ./amicadefs.param


# How to compile with Intel Fortran on Ubuntu

0. These are old instructions. Try using Intel OneAPI modifiying the commands similar to the instructions for Windows above.
1. Install Intel Fortran compiler for Linux.
2. Compile MPICH2 setting environmental vars CC, CXX, FC, and F77 to icc and ifort.
3. Compile Amica with the command:

$ /home/jason/mpich2-3.2-install/bin/mpif90 -I/opt/intel/mkl/include/ -fpp -qopenmp -O3 -mkl -static -static-intel -DMKL funmod2.f90 amica15.f90 -o amica15ub

4. Test:

$ ./amica15ub ./amicadefs.param


# How to compile with Intel Fortran on Expanse HPC

1. load appropriate modules:

```
module purge
module load cpu/0.15.4 intel intel-mkl mvapich2
```

2. Compile Amica with the command:

```
mpif90 -static-intel -fpp -O3 -march=core-avx2 -heap-arrays \
-qopenmp -mkl -DMKL -o amica15ex funmod2.f90 amica17.f90
```

3. Test:
```
$ ./amica17nsg ./amicadefs.param
```

4. Run on compute partition:

```
<Edit amicadefs.param file line to: maxthreads 4>
$ module load cpu/0.15.4 slurm intel intel-mkl mvapich2
$ export OMP_NUM_THREADS=4 ; export SRUN_CPUS_PER_TASK=4 ; export MV2_ENABLE_AFFINITY=0
$ srun --partition=compute --nodes=<NUM_NODES> --tasks-per-node=32 --cpus-per-task=4 \
--mem=249208M --account=<ACCOUNT> --export=ALL -t 04:00:00 ./amica17nsg ./amicadefs.param
<If job fails, reduce block_size in amicadefs.param. Increase block_size to speed up.>
```
Loading

0 comments on commit 11c59e4

Please sign in to comment.