|
78 | 78 | cmake |
79 | 79 | gcc14 # pin gcc version for cuda version 12 compatibility |
80 | 80 | llvmPackages.openmp |
| 81 | + cudaPackages.cuda_nvcc |
| 82 | + cudaPackages.cuda_cccl |
81 | 83 | ninja |
82 | 84 | patchelf |
83 | 85 | ]; |
84 | 86 |
|
85 | 87 | buildInputs = with pkgs; [ |
86 | 88 | hdf5 |
87 | 89 | cudaPackages.cuda_cudart |
88 | | - cudaPackages.cuda_nvcc |
89 | 90 | ]; |
90 | 91 |
|
91 | 92 | configurePhase = '' |
|
117 | 118 | installPhase = '' |
118 | 119 | mkdir -p $out/bin |
119 | 120 | cp -r bin/release/Data $out/bin |
120 | | - cp -r bin/release/rayx $out/bin |
| 121 | + cp -r bin/release/rayx $out/bin/rayx-cuda |
121 | 122 |
|
122 | 123 | mkdir -p $out/lib |
123 | 124 | cp -r lib/release/* $out/lib |
|
170 | 171 | installPhase = '' |
171 | 172 | mkdir -p $out |
172 | 173 |
|
| 174 | + LOG=$out/rayx-tests-log.txt |
173 | 175 | RML=../Intern/rayx-core/tests/input/METRIX_U41_G1_H1_318eV_PS_MLearn_v114.rml |
| 176 | +
|
174 | 177 | # run rayx with valgrind to catch memory issues |
175 | | - valgrind --error-exitcode=42 ./bin/release/rayx -x -V -i $RML |& tee $out/log_rayx.txt |
| 178 | + echo "\$ valgrind --error-exitcode=42 ./bin/release/rayx -x -V -i $RML" >> $LOG |
| 179 | + valgrind --error-exitcode=42 ./bin/release/rayx -x -V -i $RML |& tee $LOG |
| 180 | +
|
| 181 | + echo "" >> $LOG |
| 182 | +
|
176 | 183 | # run tests |
177 | | - ./bin/release/rayx-core-tst -x |& tee $out/log_rayx-core-tst.txt |
| 184 | + echo "\$ ./bin/release/rayx-core-tst -x" >> $LOG |
| 185 | + echo ./bin/release/rayx-core-tst -x |& tee $LOG |
| 186 | + ''; |
| 187 | + |
| 188 | + meta.description = "TODO"; # TODO: write description |
| 189 | + }; |
| 190 | + |
| 191 | + rayx-run-tests-cuda = pkgs.stdenv.mkDerivation { |
| 192 | + pname = "rayx-run-tests-cuda"; |
| 193 | + version = "1.1.0"; |
| 194 | + inherit src; |
| 195 | + |
| 196 | + nativeBuildInputs = with pkgs; [ |
| 197 | + cmake |
| 198 | + gcc |
| 199 | + llvmPackages.openmp |
| 200 | + ninja |
| 201 | + patchelf |
| 202 | + valgrind |
| 203 | + cudaPackages.cuda_nvcc |
| 204 | + cudaPackages.cuda_cccl |
| 205 | + ]; |
| 206 | + |
| 207 | + buildInputs = with pkgs; [ |
| 208 | + hdf5 |
| 209 | + cudaPackages.cuda_cudart |
| 210 | + ]; |
| 211 | + |
| 212 | + configurePhase = '' |
| 213 | + mkdir build |
| 214 | + cd build |
| 215 | + cmake -G Ninja .. \ |
| 216 | + -DCMAKE_BUILD_TYPE=Release \ |
| 217 | + -DRAYX_ENABLE_CUDA=ON \ |
| 218 | + -DRAYX_REQUIRE_CUDA=ON \ |
| 219 | + -DRAYX_ENABLE_OPENMP=ON \ |
| 220 | + -DRAYX_REQUIRE_OPENMP=ON \ |
| 221 | + -DRAYX_ENABLE_H5=ON \ |
| 222 | + -DRAYX_REQUIRE_H5=ON \ |
| 223 | + -DRAYX_WERROR=ON \ |
| 224 | + -DRAYX_BUILD_TESTS=ON \ |
| 225 | + -DRAYX_BUILD_RAYX_CLI=ON \ |
| 226 | + -DRAYX_BUILD_RAYX_UI=OFF |
| 227 | + ''; |
| 228 | + |
| 229 | + buildPhase = '' |
| 230 | + ninja -v rayx rayx-core-tst |
| 231 | + ''; |
| 232 | + |
| 233 | + # TODO: provide a better way to access test input file |
| 234 | + # TODO: testing should not be in the build phase, but rayx-core-tst depends on source directory being preset |
| 235 | + installPhase = '' |
| 236 | + mkdir -p $out |
| 237 | +
|
| 238 | + LOG=$out/rayx-tests-cuda-log.txt |
| 239 | + RML=../Intern/rayx-core/tests/input/METRIX_U41_G1_H1_318eV_PS_MLearn_v114.rml |
| 240 | +
|
| 241 | + # run rayx with valgrind to catch memory issues |
| 242 | + echo "\$ valgrind --error-exitcode=42 ./bin/release/rayx -X -V -i $RML" >> $LOG |
| 243 | + valgrind --error-exitcode=42 ./bin/release/rayx -X -V -i $RML |& tee $LOG |
| 244 | +
|
| 245 | + echo "" >> $LOG |
| 246 | +
|
| 247 | + # run tests |
| 248 | + echo "\$ ./bin/release/rayx-core-tst -X" >> $LOG |
| 249 | + echo ./bin/release/rayx-core-tst -X |& tee $LOG |
178 | 250 | ''; |
179 | 251 |
|
180 | 252 | meta.description = "TODO"; # TODO: write description |
|
197 | 269 |
|
198 | 270 | rayx-cuda = pkgs.mkShell { |
199 | 271 | buildInputs = with pkgs; [ |
200 | | - self.packages.${system}.rayx |
| 272 | + self.packages.${system}.rayx-cuda |
201 | 273 | hdf5 |
202 | 274 | cudaPackages.cuda_cudart |
203 | 275 | ]; |
|
207 | 279 | ''; |
208 | 280 | }; |
209 | 281 |
|
210 | | - rayx-run-tests = pkgs.mkShell { |
211 | | - buildInputs = with pkgs; [ |
212 | | - self.packages.${system}.rayx-run-tests |
213 | | - ]; |
| 282 | + default = rayx; |
| 283 | + }; |
214 | 284 |
|
215 | | - shellHook = '' |
216 | | - echo "Inspect the test results in log_rayx.txt and log_rayx-core-tst.txt" |
| 285 | + apps.${system} = { |
| 286 | + rayx-tests = { |
| 287 | + type = "app"; |
| 288 | + program = pkgs.writeShellScript "rayx-tests" '' |
| 289 | + cat ${self.packages.${system}.rayx-tests}/rayx-tests-log.txt |
217 | 290 | ''; |
218 | 291 | }; |
219 | | - |
220 | | - default = rayx; |
221 | 292 | }; |
222 | 293 | }; |
223 | 294 | } |
0 commit comments