Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conda package for cpptraj #1125

Open
wants to merge 26 commits into
base: conda
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6c3d897
first complete cpptraj build--still needs packaging work
dacase Dec 19, 2024
0546fe9
tweaks to readline for first conda build
dacase Dec 19, 2024
3110aca
tweaks to build.sh: no -openmp, include activate
dacase Dec 19, 2024
44e4b19
to first version 0.1 on linux
dacase Dec 20, 2024
bba2b94
include <algorithm> header, needed for the copy() and fill() methods
dacase Dec 21, 2024
d81868f
defined NEED_EXTERN_PC to prevent duplicate symbols in libreadine.a. …
dacase Dec 21, 2024
ed4f9a6
use clang for Darwin, gnu for Linux
dacase Dec 21, 2024
5a0e164
fix typos in build.sh; add arpack, openmm and openmp libraries
dacase Dec 21, 2024
dbd119e
Revert "defined NEED_EXTERN_PC to prevent duplicate symbols in librea…
dacase Dec 21, 2024
3523e66
Revert "tweaks to readline for first conda build"
dacase Dec 21, 2024
8d5d4b8
use -lncurses rather than ltermcap for external readline; will this b…
dacase Dec 22, 2024
40e0ddc
look for readline headers in readline subdirectory, as I think should…
dacase Dec 22, 2024
3b476d9
add readline to build, test to package
dacase Dec 22, 2024
c4e5807
bump to version 0.3, mpi, pnetcdf, readline
dacase Dec 22, 2024
4698ed7
build mpi, cuda and serial variants on Linux
dacase Dec 23, 2024
a92de0f
fix glitch in build.sh that led to cpptraj itself not getting built
dacase Dec 23, 2024
5c28c8e
update location and sha to version 0.4
dacase Dec 23, 2024
6814bbb
minor tweaks to mkrelease
dacase Dec 23, 2024
d4344f8
only use coreutils and nvcc_linux-64 on linux
dacase Dec 23, 2024
466deca
seems to be able to compile on osx with openmp enabled
dacase Dec 25, 2024
aa8cd72
go back to using path: rather than url:/sha: for now
dacase Dec 27, 2024
1a7f1a8
mostly working, but need to get recursive headers into include/cpptra…
dacase Jan 6, 2025
07d6c59
Try to improve compatibility with system readline libraries (#1126)
drroe Jan 8, 2025
14d4b0d
no longer need to skip aarch64
dacase Jan 10, 2025
a2a43ea
Have configure and cmake install headers for libcpptraj (#1129)
drroe Jan 14, 2025
f7493ef
Merge branch 'master' into conda
dacase Jan 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ unittest: config.h
# Clean up
clean: config.h
cd src && $(MAKE) clean
cd test && $(MAKE) clean
cd unitTests && $(MAKE) clean
# cd test && $(MAKE) clean
# cd unitTests && $(MAKE) clean

docs: src/cpptraj.Doxyfile
cd doc && make docs
Expand Down
12 changes: 6 additions & 6 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -1073,7 +1073,7 @@ EOF
TestReadline() {
cat > testp.cpp <<EOF
#include <cstdio>
#include <readline.h>
#include <readline/readline.h>
static char *line_read = (char *)NULL;
// Do not want to actually run this so leave outside main
void Unused() { line_read = readline(""); }
Expand Down Expand Up @@ -1514,11 +1514,11 @@ SetupLibraries() {
if [ $i -eq $LREADLINE ] ; then
# For external readline, we need to link libtermcap for windows
# and libncurses for Linux
#if [ $USE_WINDOWS -eq 1 ]; then
if [ $USE_WINDOWS -eq 1 ]; then
lflag="$lflag -ltermcap"
#else
# lflag="$lflag -lncurses"
#fi
else
lflag="$lflag -lncurses"
fi
elif [ $i -eq $LSANDER ] ; then
# Always specify libsander location to prevent pulling in
# other amber libraries.
Expand Down Expand Up @@ -1662,7 +1662,7 @@ SetupCompilers() {
if [ -z "$FC" ]; then FC=gfortran; fi
hostflags=''
optflags='-O3'
ompflag='-fopenmp'
ompflag='-Xclang -fopenmp'
freefmtflag='-ffree-form'
foptflags='-O3'
FLINK='-lgfortran'
Expand Down
14 changes: 14 additions & 0 deletions mkrelease
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh

version=$1

tar cvf ../cpptraj-$version.tar configure dat get_library.sh \
LICENSE Makefile src test doc README.md
cd ..
gzip cpptraj-$version.tar

rsync -av cpptraj-$version.tar.gz \
[email protected]:ambermd-website.rcsb.rutgers.edu/downloads

curl -sL https://ambermd.org/downloads/cpptraj-$version.tar.gz | openssl sha256

4 changes: 4 additions & 0 deletions recipe/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

export CPPTRAJHOME=${CONDA_PREFIX}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add export CPPTRAJ_HEADERDIR=${CONDA_PREFIX}/include/cpptraj so pytraj can find the header files. Ideally, we should use CPPTRAJHOME/include but the header files might overwrite other library's headers, so we make "cpptraj" folder.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hainm do a conda install dacase::cpptraj (only for linux-64 right now), and see if libraries and headers seem to be in the proper places with the proper information.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@hainm do a conda install dacase::cpptraj (only for linux-64 right now), and see if libraries and headers seem to be in the proper places with the proper information.

@dacase I confirm that I do see $PREFIX/lib/libcpptraj.so and $PREFIX/include/cpptraj/*.h
Thanks.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dacase It seems we need to recursively include the .h files too. pytraj only uses a subset of them but one header refers another/other header file(s), so think we need to include all.

image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

41 changes: 41 additions & 0 deletions recipe/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/bin/sh

export NVCC=nvcc
# export SHADER_MODEL=sm_89

arch=`uname`

if [ "$arch" == "Darwin" ]; then

./configure -openmp -readline -openmm -openblas -fftw3 -zlib -bzlib -shared -arpack clang
make install
make clean
./configure -mpi -readline -openmm -openblas -fftw3 -zlib -bzlib -shared -arpack clang
make install
make clean
./configure -readline -openmm -openblas -fftw3 -zlib -bzlib -shared -arpack clang
make install

else

./configure -cuda -readline -openmm -openblas -fftw3 -zlib -bzlib -shared -arpack gnu
make install
make clean
./configure -mpi -readline -openmm -openblas -fftw3 -zlib -bzlib -shared -arpack gnu
make install
make clean
./configure -readline -openmm -openblas -fftw3 -zlib -bzlib -shared -arpack gnu
make install

fi


rsync -a README.md config.h LICENSE dat bin lib test $PREFIX

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mkdir -p $PREFIX/include/cpptraj 
rsync src/*.h $PREFIX/include/cpptraj/  # Not sure if this is correct syntax :D 

mkdir -p $PREFIX/doc
rsync -a doc/CpptrajManual.pdf $PREFIX/doc

# Export CPPTRAJHOME automatically
mkdir -p ${PREFIX}/etc/conda/{activate,deactivate}.d
cp ${RECIPE_DIR}/activate.sh ${PREFIX}/etc/conda/activate.d/cpptraj.sh
cp ${RECIPE_DIR}/deactivate.sh ${PREFIX}/etc/conda/deactivate.d/cpptraj.sh
8 changes: 8 additions & 0 deletions recipe/conda_build_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
c_compiler_version:
- 11.4.0 # [linux]

cxx_compiler_version:
- 11.4.0 # [linux]

fortran_compiler_version:
- 11.4.0 # [linux]
4 changes: 4 additions & 0 deletions recipe/deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

unset CPPTRAJHOME

84 changes: 84 additions & 0 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
{% set version = "0.4" %}
{% set mpi = "mpich" %}

package:
name: cpptraj
# version 0.1 trying to adapt recipe from AmberClassic
# version 0.2 small tweaks get allow osx-64 build
# version 0.3 add mpi and pnetcdf support
# version 0.4 build from url; add cuda
version: {{ version }}

source:
path: ../
# url: https://ambermd.org/downloads/cpptraj-{{ version }}.tar.gz
# sha256: 6be4dda3f6f59610d97b2cdb8f6745ca05cff60705ba95dbcfc07c10fd083d95

build:
number: 1
skip: True # [win or ppc65le or aarch64]

mpi:
- {{ mpi }}

requirements:
build:
- make
- {{ compiler('fortran') }}
- {{ compiler('c') }}
- {{ compiler('cxx') }}
- {{ mpi }} # [ mpi == "mpich" ]
- libpnetcdf
- {{ compiler('nvcc') }} # [ linux ]
- coreutils # [ linux ]
- nvcc_linux-64 # [ linux ]
- llvm-openmp # [osx]
- libgomp # [linux]
- fftw
- readline
- libnetcdf
- netcdf-fortran

host:
- openblas
- arpack
- openmm
- libnetcdf
- netcdf-fortran
- llvm-openmp # [osx]
- libgomp # [linux and not aarch64]
- {{ mpi }} # [ mpi == "mpich" ]
- libpnetcdf
- fftw
- readline

run:
- llvm-openmp # [osx]
- libgomp # [linux and not aarch64]
- openblas
- arpack
- openmm
- libnetcdf
- netcdf-fortran
- {{ mpi }} # [ mpi == "mpich" ]
- libpnetcdf
- fftw
- readline

test:
commands:
- cpptraj --help

about:
home: https://github.com/Amber-MD/cpptraj.git
license: GPL-3.0-or-later
license_file:
- LICENSE
summary: 'Performs analysis of MD trajectories, especially for biomolecules'
description: |
CPPTRAJ is a program designed to process and analyze molecular
dynamics trajectories and relevant data sets derived from their
analysis. CPPTRAJ supports many popular MD software packages including
Amber, CHARMM, Gromacs, and NAMD.


1 change: 1 addition & 0 deletions src/Matrix.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define INC_MATRIX_H
#include "ArrayIterator.h"
#include <cmath> // For linear least squares
#include <algorithm> // For copy()
/// Two-dimensional matrix template.
template <class T> class Matrix {
// TODO: Type may not be necessary here if in DataSet_2D
Expand Down
4 changes: 2 additions & 2 deletions src/ReadLine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# include <iostream>
#else
# define READLINE_LIBRARY
# include <readline.h>
# include <history.h>
# include <readline/readline.h>
# include <readline/history.h>
#endif
#include "ReadLine.h"
#include "Command.h"
Expand Down
Loading