-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from PrincetonUniversity/ci
Change version to 2.75 and begin to automatically check compilation
- Loading branch information
Showing
11 changed files
with
415 additions
and
53 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,22 @@ | ||
name: build-test | ||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
container: zhucaoxiang/stellopt:compile | ||
env: | ||
MACHINE: docker | ||
STELLOPT_PATH: ${{ github.workspace }} | ||
OMPI_ALLOW_RUN_AS_ROOT: 1 | ||
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1 | ||
steps: | ||
- name: checkout sources | ||
uses: actions/checkout@master | ||
- name: compile | ||
run: | | ||
cd ${STELLOPT_PATH} | ||
./build_all -o clean_debug -j 2 | ||
- name: test | ||
run: | | ||
mpiexec ./bin/xstelloptv2 test -h |
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,48 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
""" | ||
@author: Caoxiang Zhu ([email protected]) | ||
For any help, type ./compare_VMEC.py -h | ||
""" | ||
import numpy as np | ||
import xarray | ||
import argparse | ||
|
||
# parse command line arguments | ||
# ============================================================================= | ||
parser = argparse.ArgumentParser(description="Compare two VMEC netcdf outputs") | ||
parser.add_argument("filename", type=str, help="file name to be compared") | ||
parser.add_argument("reference", type=str, help="reference data") | ||
parser.add_argument("-t", "--tol", type=float, default=1E-8, help="difference tolerance") | ||
|
||
args = parser.parse_args() | ||
print('Compare VMEC outputs in {:s} and {:s} with tolerance {:12.5E}'.format(args.filename, args.reference, args.tol)) | ||
data = xarray.open_dataset(args.filename) | ||
ref = xarray.open_dataset(args.reference) | ||
|
||
tol = args.tol | ||
match = True | ||
skip_list = ['version_'] | ||
loose_list = ['jcuru', 'jdotb', 'currumnc', 'currvmnc'] # j related terms must have large tol | ||
|
||
print('======================================') | ||
for key in ref: | ||
if key in skip_list: | ||
continue | ||
if key in loose_list: | ||
tol = max(1E-3, tol) | ||
else: | ||
tol = args.tol | ||
try: | ||
diff = np.linalg.norm(ref[key].values - data[key].values)/len(ref[key].values) | ||
unmatch = diff > tol | ||
if unmatch: | ||
match = False | ||
print('UNMATCHED: '+key+', diff={:12.5E}'.format(diff)) | ||
except TypeError: | ||
pass | ||
print(' comparison passed: {:} '.format(match)) | ||
print('======================================') | ||
assert match, 'Differences in some elements are larger than the tolerence.' | ||
|
||
exit |
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
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,23 @@ | ||
FROM zhucaoxiang/stellopt:compile | ||
MAINTAINER Caoxiang Zhu <[email protected]> & STELLOPT developers | ||
|
||
WORKDIR /home/STELLOPT | ||
|
||
COPY . /home/STELLOPT | ||
# Compile STELLOPT | ||
ENV MACHINE="docker" | ||
ENV STELLOPT_PATH=/home/STELLOPT | ||
RUN echo $STELLOPT_PATH | ||
RUN cd $STELLOPT_PATH && ./build_all -j4 2>&1 | tee log.build | ||
RUN chmod -R 777 ${STELLOPT_PATH}/BENCHMARKS | ||
RUN cp -RP ${STELLOPT_PATH}/bin/* /usr/local/bin/ | ||
|
||
# add user | ||
WORKDIR /home/visitor | ||
RUN groupadd -r visitor -g 433 && \ | ||
useradd -u 431 -r -g visitor -d /home/visitor -s /sbin/nologin -c "Docker image user" visitor && \ | ||
chown -R visitor:visitor /home/visitor | ||
USER visitor | ||
|
||
# Set commands | ||
CMD ["/bin/bash"] |
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
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,139 @@ | ||
####################################################################### | ||
# Define Basic Utilities | ||
####################################################################### | ||
SHELL = /bin/sh | ||
PWD1 = `pwd` | ||
MYHOME = $(STELLOPT_PATH)/bin | ||
PRECOMP:= /lib/cpp -traditional -DLINUX | ||
COMPILE = $(FC) | ||
COMPILE_FREE = $(FC) -ffree-form -ffree-line-length-none -ffixed-line-length-none | ||
LINK = ld $(FLAGS) -o | ||
LINK_AR = ar -ruv | ||
LINK_C = $(CC) -shared -Wl,-z-defs | ||
|
||
####################################################################### | ||
# Define Compiler Flags | ||
####################################################################### | ||
FLAGS_R = -O2 -fexternal-blas | ||
FLAGS_D = -g -O0 -fexternal-blas -fbacktrace -fcheck=all | ||
LIBS = -L/usr/lib -lscalapack-openmpi -lblas -llapack | ||
|
||
####################################################################### | ||
# MPI Options | ||
####################################################################### | ||
LMPI = T | ||
MPI_COMPILE = mpif90 | ||
MPI_COMPILE_FREE = mpif90 -ffree-form \ | ||
-ffree-line-length-none -ffixed-line-length-none | ||
MPI_COMPILE_C = mpicc | ||
MPI_LINK = mpif90 | ||
MPI_RUN = mpiexec | ||
MPI_RUN_OPTS = | ||
# MPI_RUN_OPTS_SM = -np 16 | ||
# MPI_RUN_OPTS_MD = -np 64 | ||
# MPI_RUN_OPTS_LG = -np 256 | ||
|
||
####################################################################### | ||
# NAG Options | ||
####################################################################### | ||
LNAG = F | ||
NAG_LIB = -L$(NAG_ROOT)/lib -lnag_nag | ||
|
||
####################################################################### | ||
# NETCDF Options | ||
####################################################################### | ||
LNETCDF = T | ||
NETCDF_INC = -I/usr/include | ||
NETCDF_LIB = -L/usr/lib -lnetcdf -lnetcdff | ||
|
||
####################################################################### | ||
# NTCC Options | ||
####################################################################### | ||
LNTCC = F | ||
NTCC_INC = -I/usr/include | ||
NTCC_LIB = -L/usr/lib -laladdinsub -lr8slatec -ladpak\ | ||
-lcppsub -lcomput -lpspline -lportlib -lezcdf -lmds_sub \ | ||
-lmdstransp -lvaxonly | ||
|
||
####################################################################### | ||
# HDF5 Options | ||
####################################################################### | ||
LHDF5 = T | ||
HDF5_INC = -I/usr/include/hdf5/openmpi | ||
HDF5_LIB = -L/usr/lib/x86_64-linux-gnu/hdf5/openmpi \ | ||
-lhdf5 -lhdf5hl_fortran -lhdf5_hl -lhdf5_fortran | ||
|
||
####################################################################### | ||
# PGPLOT Options | ||
####################################################################### | ||
LPGPLOT = F | ||
PGPLOT_INC = -I$(PGPLOT_DIR) | ||
PGPLOT_LIB = -L$(PGPLOT_DIR) -lpgplot -L/usr/lib/x86_64-linux-gnu -lX11 | ||
|
||
####################################################################### | ||
# SILO Options | ||
####################################################################### | ||
LSILO = F | ||
SILO_INC = -I$(SILOHOME)/include | ||
SILO_LIB = -L$(SILOHOME)/lib/x86_64-linux-gnu -lsiloh5 | ||
|
||
####################################################################### | ||
# DKES/NEO Options | ||
####################################################################### | ||
LDKES = T | ||
LNEO = T | ||
|
||
####################################################################### | ||
# GENE Options | ||
####################################################################### | ||
LGENE = F | ||
GENE_INC = -I$(GENE_PATH) | ||
GENE_DIR = $(GENE_PATH) | ||
LIB_GENE = libgene.a | ||
GENE_LIB = $(GENE_DIR)/$(LIB_GENE) \ | ||
-L/u/slazerso/src/GENE17_2016/external/pppl_cluster/futils/src -lfutils \ | ||
-L$(FFTWHOME)/lib -lfftw3 \ | ||
-L$(SLEPC_DIR)/$(PETSC_ARCH)/lib -lslepc \ | ||
-L$(PETSC_DIR)/$(PETSC_ARCH)/lib -lpetsc -lX11 | ||
|
||
####################################################################### | ||
# COILOPT++ Options | ||
####################################################################### | ||
LCOILOPT = F | ||
COILOPT_INC = -I$(COILOPT_PATH) | ||
COILOPTPP_DIR = $(COILOPT_PATH) | ||
LIB_COILOPTPP = libcoilopt++.a | ||
COILOPT_LIB = $(COILOPT_PATH)/$(LIB_COILOPTPP) \ | ||
-L$(GSLHOME)/lib/x86_64-linux-gnu -lgsl -lgslcblas -lstdc++ -lmpi_cxx | ||
|
||
####################################################################### | ||
# TERPSICHORE Options | ||
####################################################################### | ||
LTERPSICHORE= F | ||
TERPSICHORE_INC = -I$(TERPSICHORE_PATH) | ||
TERPSICHORE_DIR = $(TERPSICHORE_PATH) | ||
LIB_TERPSICHORE = libterpsichore.a | ||
TERPSICHORE_LIB = $(TERPSICHORE_DIR)/$(LIB_TERPSICHORE) | ||
|
||
####################################################################### | ||
# TRAVIS Options | ||
####################################################################### | ||
LTRAVIS= F | ||
TRAVIS_DIR = $(TRAVIS_PATH) | ||
LIB_TRAVIS = libtravis64_sopt.a | ||
LIB_MCONF = libmconf64.a | ||
TRAVIS_LIB = $(TRAVIS_DIR)/lib/$(LIB_TRAVIS) \ | ||
$(TRAVIS_DIR)/mag_conf/lib/$(LIB_MCONF) -lstdc++ | ||
|
||
####################################################################### | ||
# REGCOIL Options | ||
####################################################################### | ||
LREGCOIL= F | ||
REGCOIL_DIR = $(REGCOIL_PATH) | ||
REGCOIL_INC = -I$(REGCOIL_DIR) | ||
LIB_REGCOIL = libregcoil.a | ||
REGCOIL_LIB = $(REGCOIL_DIR)/$(LIB_REGCOIL) -fopenmp | ||
|
||
####################################################################### | ||
# LIBSTELL Shared Options | ||
####################################################################### |
Oops, something went wrong.