summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 13915cd516c549b38775655aafa7acf8ccd312dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
# Maintainer: realasking <realasking@outlook.com>


# HTML documentation
_BUILD_DOC=0
# Copy 'examples' to /usr/share/examples/lammps
_INSTALL_EXAMPLES=1


_pkgname=lammps
pkgname=${_pkgname}-ryzen-opencl
pkgver=r30482.1b8641685a
pkgrel=1
pkgdesc="lammps with opencl support ONLY for ryzen cpu and amd gpu, modified from pyskets's lammps package"
url="https://lammps.sandia.gov/"
arch=('x86_64')
license=('GPL')
depends=('fftw' 'openmpi' 'opencl-amd' 'voro++' 'env-modules')
makedepends=('cmake>=3.1')
conflicts=('lammps')
provides=('lammps')
source=('git+https://github.com/lammps/lammps.git')
sha512sums=('SKIP')

# process the build settings from above
if (( $_BUILD_DOC )); then
    makedepends+=('python-sphinx')
fi


pkgver() {
  cd "${_pkgname}"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
  mkdir -p ${srcdir}/${_pkgname}_cpu/build
  mkdir -p ${srcdir}/${_pkgname}_gpu/build
}

build() {
  cd ${srcdir}/${_pkgname}_cpu/build
  cmake ../../${_pkgname}/cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX="/opt/lammps/cpu" \
    -DPKG_CORESHELL=ON \
    -DPKG_DIPOLE=ON \
    -DPKG_GRANULAR=ON \
    -DPKG_MOLECULE=ON \
    -DPKG_PERI=ON \
    -DPKG_MC=ON  \
    -DPKG_MISC=ON \
    -DPKG_GPU=OFF \
    -DPKG_USER-MEAMC=ON \
    -DPKG_USER-REAXC=ON \
    -DPKG_REPLICA=ON \
    -DPKG_KSPACE=ON \
    -DPKG_POEMS=ON \
    -DPKG_MANYBODY=ON \
    -DPKG_USER-ATC=ON \
    -DPKG_USER-AWPMD=ON \
    -DPKG_USER-DIFFRACTION=ON \
    -DPKG_VORONOI=ON -DDOWNLOAD_VORO=OFF \
    -DPKG_USER-FEP=ON \
    -DPKG_USER-MOLFILE=ON \
    -DPKG_USER-PHONON=ON \
    -DPKG_USER-VTK=OFF \
    -DPKG_KOKKOS=OFF \
    -DPKG_KIM=OFF \
    -DPKG_LATTE=OFF \
    -DDOWNLOAD_KIM=OFF \
    -DBUILD_OMP=OFF \
    -DPKG_OPT=ON \
    -DPKG_USER-OMP=OFF \
    -DBUILD_LIB=ON \
    -DBUILD_EXE=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DPKG_PYTHON=ON \
    -DCMAKE_C_COMPILER=mpicc \
    -DCMAKE_CXX_COMPILER=mpicxx \
    -DCMAKE_Fortran_COMPILER=mpif90 \
    -DFFT=FFTW3 \
    -DCMAKE_CXX_FLAGS="-O3" \
    "${_feature_args[@]}" #\
  make -j8


  cd ${srcdir}/${_pkgname}_gpu/build
  cmake ../../${_pkgname}/cmake \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX="/opt/lammps/gpu" \
    -DPKG_CORESHELL=ON \
    -DPKG_DIPOLE=ON \
    -DPKG_GRANULAR=ON \
    -DPKG_MOLECULE=ON \
    -DPKG_PERI=ON \
    -DPKG_MC=ON  \
    -DPKG_MISC=ON \
    -DPKG_USER-MEAMC=ON \
    -DPKG_USER-REAXC=ON \
    -DPKG_REPLICA=ON \
    -DPKG_KSPACE=ON \
    -DPKG_POEMS=ON \
    -DPKG_MANYBODY=ON \
    -DPKG_USER-ATC=ON \
    -DPKG_USER-AWPMD=ON \
    -DPKG_USER-DIFFRACTION=ON \
    -DPKG_VORONOI=ON -DDOWNLOAD_VORO=OFF \
    -DPKG_USER-FEP=ON \
    -DPKG_USER-MOLFILE=ON \
    -DPKG_USER-PHONON=ON \
    -DPKG_USER-VTK=OFF \
    -DPKG_KOKKOS=OFF \
    -DPKG_KIM=OFF \
    -DPKG_LATTE=OFF \
    -DDOWNLOAD_KIM=OFF \
    -DBUILD_OMP=OFF \
    -DPKG_OPT=ON \
    -DPKG_USER-OMP=OFF \
    -DBUILD_LIB=ON \
    -DBUILD_EXE=ON \
    -DBUILD_SHARED_LIBS=ON \
    -DPKG_PYTHON=ON \
    -DCMAKE_C_COMPILER=mpicc \
    -DCMAKE_CXX_COMPILER=mpicxx \
    -DCMAKE_Fortran_COMPILER=mpif90 \
    -DFFT=FFTW3 \
    -DPKG_GPU=on -DGPU_API=OPENCL -DGPU_PREC=single \
    -DCMAKE_CXX_FLAGS="-O3" \
    "${_feature_args[@]}" #\

  make -j8


  if (( $_BUILD_DOC )) ; then
    # Generate ReStructuredText from Text files
    mkdir -p rst

    for file in ../../${_pkgname}/doc/src/*.txt
    do
      tmp=${file%.*} # Strips the '.txt' extension
      fname=${tmp##*/} # Strips the path prefixing the file-name
      ../../${_pkgname}/doc/utils/converters/lammpsdoc/txt2rst.py ${file} > "rst/${fname}.rst"
    done

    # Generate HTML from ReStructuredText files
    mkdir -p html
    cp -r ../../${_pkgname}/doc/src/* rst/

    sphinx-build -b html -c "../../${_pkgname}/doc/utils/sphinx-config" -d "doctrees" "rst" html
  fi
}

package() {
  cd ${srcdir}
  install -Dm644 ../lammps_cpu_mod ${pkgdir}/etc/modules/modulefiles/lammps_Ryzen5
  install -Dm644 ../lammps_gpu_single_mod ${pkgdir}/etc/modules/modulefiles/lammps_OpenCL_single
  #install -Dm755 ../pos2lmp.awk ${pkgdir}/opt/lammps/cpu/bin/pos2lmp.awk
  #install -Dm755 ../pos2lmp.awk ${pkgdir}/opt/lammps/gpu/bin/pos2lmp.awk
  cd ${srcdir}/${_pkgname}_cpu/build
  #cd ${_pkgname}_cpu/build
  make DESTDIR=${pkgdir} install
  cd ${srcdir}/${_pkgname}_gpu/build
  #cd ${_pkgname}_gpu/build
  make DESTDIR=${pkgdir} install
  
  if (( $_BUILD_DOC )) ; then
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html" "html/"*.html
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html" "html/"*.js
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html/_images" "html/_images/"*
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html/_static" "html/_static/"*.png
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html/_static" "html/_static/"*.js
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html/_static/css" "html/_static/css/"*.css
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html/_static/fonts" "html/_static/fonts/"*
    install -Dm644 -t "${pkgdir}/usr/share/doc/${_pkgname}/html/_static/js" "html/_static/js/"*.js
  fi
  if (( $_INSTALL_EXAMPLES )) ; then
    mkdir -p "${pkgdir}/usr/share/examples/lammps"
    cp -r "../../${_pkgname}/examples/"* "${pkgdir}/usr/share/examples/lammps/"
    find "${pkgdir}/usr/share/examples/lammps/" -type f -exec chmod 644 '{}' +
  fi
  install -Dm644 "../../${_pkgname}/tools/vim/lammps.vim" "${pkgdir}/usr/share/vim/vimfiles/syntax/lammps.vim"
  install -Dm644 "../../${_pkgname}/tools/vim/filetype.vim" "${pkgdir}/usr/share/vim/vimfiles/ftdetect/lammps.vim"
}