meep-gpu 0.9.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- meep_gpu/LICENSE +339 -0
- meep_gpu/NOTICE +21 -0
- meep_gpu/__init__.py +208 -0
- meep_gpu/absorber.py +316 -0
- meep_gpu/amp_interpolation.py +158 -0
- meep_gpu/backends.py +362 -0
- meep_gpu/code_identity.py +144 -0
- meep_gpu/conftest.py +399 -0
- meep_gpu/cuda_kernels/__init__.py +6 -0
- meep_gpu/cuda_kernels/ade_kernels.py +519 -0
- meep_gpu/cuda_kernels/arms.py +1311 -0
- meep_gpu/cuda_kernels/bfast_curl.py +757 -0
- meep_gpu/cuda_kernels/bfast_fused_electric_pair.py +730 -0
- meep_gpu/cuda_kernels/bfast_fused_magnetic_pair.py +611 -0
- meep_gpu/cuda_kernels/certification.json +21804 -0
- meep_gpu/cuda_kernels/compile_cache.py +259 -0
- meep_gpu/cuda_kernels/complex_beta_fused_electric_pair.py +593 -0
- meep_gpu/cuda_kernels/complex_beta_fused_hd_pair.py +1067 -0
- meep_gpu/cuda_kernels/complex_beta_fused_magnetic_pair.py +560 -0
- meep_gpu/cuda_kernels/complex_beta_kernels.py +857 -0
- meep_gpu/cuda_kernels/complex_electric_fill_carry.py +766 -0
- meep_gpu/cuda_kernels/complex_emitter.py +645 -0
- meep_gpu/cuda_kernels/complex_fill_carry.py +717 -0
- meep_gpu/cuda_kernels/complex_folded_fused_electric_pair.py +561 -0
- meep_gpu/cuda_kernels/complex_folded_fused_magnetic_pair.py +652 -0
- meep_gpu/cuda_kernels/complex_folded_kernels.py +895 -0
- meep_gpu/cuda_kernels/complex_fused_electric_pair.py +1024 -0
- meep_gpu/cuda_kernels/complex_fused_hd_pair.py +1270 -0
- meep_gpu/cuda_kernels/complex_fused_magnetic_pair.py +885 -0
- meep_gpu/cuda_kernels/complex_no_pml_fused_polarization_pair.py +677 -0
- meep_gpu/cuda_kernels/complex_no_pml_kernels.py +1709 -0
- meep_gpu/cuda_kernels/complex_no_pml_offdiag_fused_electric_pair.py +754 -0
- meep_gpu/cuda_kernels/complex_no_pml_three_slot_dispersive_weld.py +824 -0
- meep_gpu/cuda_kernels/complex_offdiag_stencil_weld.py +1090 -0
- meep_gpu/cuda_kernels/complex_offdiag_update_e.py +1941 -0
- meep_gpu/cuda_kernels/complex_pml_kernels.py +473 -0
- meep_gpu/cuda_kernels/conductive_bfast_fused_hd_pair.py +1445 -0
- meep_gpu/cuda_kernels/conductive_fused_electric_pair.py +1006 -0
- meep_gpu/cuda_kernels/conductive_kernels.py +1104 -0
- meep_gpu/cuda_kernels/constitutive_kernels.py +606 -0
- meep_gpu/cuda_kernels/coverage.py +3151 -0
- meep_gpu/cuda_kernels/cylindrical_complex_kernels.py +1101 -0
- meep_gpu/cuda_kernels/cylindrical_coverage.py +540 -0
- meep_gpu/cuda_kernels/cylindrical_fused_electric_pair.py +1316 -0
- meep_gpu/cuda_kernels/cylindrical_fused_hd_pair.py +771 -0
- meep_gpu/cuda_kernels/cylindrical_fused_magnetic_pair.py +1143 -0
- meep_gpu/cuda_kernels/cylindrical_kernels.py +534 -0
- meep_gpu/cuda_kernels/cylindrical_prefix.py +83 -0
- meep_gpu/cuda_kernels/cylindrical_real_fused_electric_pair.py +837 -0
- meep_gpu/cuda_kernels/cylindrical_real_fused_hd_pair.py +685 -0
- meep_gpu/cuda_kernels/cylindrical_real_fused_magnetic_pair.py +708 -0
- meep_gpu/cuda_kernels/dispersive_fused_electric_pair.py +950 -0
- meep_gpu/cuda_kernels/dispersive_kernels.py +1403 -0
- meep_gpu/cuda_kernels/dispersive_offdiag_fused_polarization_pair.py +649 -0
- meep_gpu/cuda_kernels/dispersive_offdiag_update_e.py +1719 -0
- meep_gpu/cuda_kernels/fingerprints.json +4694 -0
- meep_gpu/cuda_kernels/folded_complex_offdiag_fused_electric_pair.py +858 -0
- meep_gpu/cuda_kernels/folded_offdiag_fused_electric_pair.py +931 -0
- meep_gpu/cuda_kernels/folded_offdiag_kernels.py +1375 -0
- meep_gpu/cuda_kernels/fused_electric_pair.py +1706 -0
- meep_gpu/cuda_kernels/fused_hd_pair.py +1313 -0
- meep_gpu/cuda_kernels/fused_magnetic_pair.py +1880 -0
- meep_gpu/cuda_kernels/fused_pairs.py +5127 -0
- meep_gpu/cuda_kernels/fused_polarization_pair.py +1145 -0
- meep_gpu/cuda_kernels/in_seam_coverage.py +504 -0
- meep_gpu/cuda_kernels/in_seam_passes.py +736 -0
- meep_gpu/cuda_kernels/no_pml_complex_fused_electric_pair.py +1387 -0
- meep_gpu/cuda_kernels/no_pml_constitutive.py +733 -0
- meep_gpu/cuda_kernels/no_pml_curl.py +1055 -0
- meep_gpu/cuda_kernels/no_pml_dispersive_fused_electric_pair.py +1100 -0
- meep_gpu/cuda_kernels/no_pml_three_slot_dispersive_weld.py +244 -0
- meep_gpu/cuda_kernels/nonlinear_constitutive.py +989 -0
- meep_gpu/cuda_kernels/offdiag_constitutive_kernels.py +401 -0
- meep_gpu/cuda_kernels/offdiag_emitter.py +504 -0
- meep_gpu/cuda_kernels/offdiag_fused_electric_pair.py +979 -0
- meep_gpu/cuda_kernels/offdiag_stencil_weld.py +763 -0
- meep_gpu/cuda_kernels/own_cell_hoist.py +266 -0
- meep_gpu/cuda_kernels/own_cell_hoist_reference.json +2150 -0
- meep_gpu/cuda_kernels/registry.py +763 -0
- meep_gpu/cuda_kernels/special_kz_curl.py +677 -0
- meep_gpu/cuda_kernels/special_kz_fused_electric_pair.py +722 -0
- meep_gpu/cuda_kernels/special_kz_fused_hd_pair.py +847 -0
- meep_gpu/cuda_kernels/special_kz_fused_magnetic_pair.py +724 -0
- meep_gpu/cuda_kernels/step_curl_kernels.py +833 -0
- meep_gpu/cuda_kernels/test_ade_strings_parse_cache.py +186 -0
- meep_gpu/cuda_kernels/test_ade_update_p.py +1200 -0
- meep_gpu/cuda_kernels/test_arms.py +614 -0
- meep_gpu/cuda_kernels/test_bfast_curl.py +450 -0
- meep_gpu/cuda_kernels/test_certification_metadata.py +532 -0
- meep_gpu/cuda_kernels/test_certification_record.py +798 -0
- meep_gpu/cuda_kernels/test_compile_cache.py +431 -0
- meep_gpu/cuda_kernels/test_complex_beta.py +642 -0
- meep_gpu/cuda_kernels/test_complex_beta_fused_hd_pair.py +340 -0
- meep_gpu/cuda_kernels/test_complex_folded.py +969 -0
- meep_gpu/cuda_kernels/test_complex_fused_electric_pairs.py +1181 -0
- meep_gpu/cuda_kernels/test_complex_no_pml.py +1000 -0
- meep_gpu/cuda_kernels/test_complex_no_pml_three_slot_dispersive_weld.py +315 -0
- meep_gpu/cuda_kernels/test_complex_offdiag_stencil_welds.py +702 -0
- meep_gpu/cuda_kernels/test_complex_offdiag_update_e.py +1503 -0
- meep_gpu/cuda_kernels/test_complex_pml.py +1211 -0
- meep_gpu/cuda_kernels/test_conductive_bfast_fused_hd_pair.py +392 -0
- meep_gpu/cuda_kernels/test_conductive_fused_electric_pair.py +573 -0
- meep_gpu/cuda_kernels/test_conductive_kernels.py +988 -0
- meep_gpu/cuda_kernels/test_constitutive_pml_real.py +2671 -0
- meep_gpu/cuda_kernels/test_cylindrical_complex.py +842 -0
- meep_gpu/cuda_kernels/test_cylindrical_fused_electric_pair_hoist.py +95 -0
- meep_gpu/cuda_kernels/test_cylindrical_fused_magnetic_pair_hoist.py +91 -0
- meep_gpu/cuda_kernels/test_cylindrical_pml_real.py +727 -0
- meep_gpu/cuda_kernels/test_dispersive.py +910 -0
- meep_gpu/cuda_kernels/test_dispersive_fused_electric_pair.py +761 -0
- meep_gpu/cuda_kernels/test_dispersive_offdiag_polarization_pair.py +354 -0
- meep_gpu/cuda_kernels/test_dispersive_offdiag_update_e.py +1590 -0
- meep_gpu/cuda_kernels/test_folded_offdiag.py +1625 -0
- meep_gpu/cuda_kernels/test_fused_electric_pair.py +896 -0
- meep_gpu/cuda_kernels/test_fused_hd_pair.py +370 -0
- meep_gpu/cuda_kernels/test_fused_magnetic_pair_fill_carry.py +982 -0
- meep_gpu/cuda_kernels/test_fused_pair_held_source.py +701 -0
- meep_gpu/cuda_kernels/test_fused_pairs.py +1046 -0
- meep_gpu/cuda_kernels/test_fused_polarization_pair.py +583 -0
- meep_gpu/cuda_kernels/test_in_seam_passes.py +685 -0
- meep_gpu/cuda_kernels/test_kernel_partition.py +378 -0
- meep_gpu/cuda_kernels/test_no_pml_complex_fused_electric_pair.py +1366 -0
- meep_gpu/cuda_kernels/test_no_pml_constitutive.py +1061 -0
- meep_gpu/cuda_kernels/test_no_pml_curl.py +1067 -0
- meep_gpu/cuda_kernels/test_no_pml_dispersive_fused_electric_pair.py +648 -0
- meep_gpu/cuda_kernels/test_nonlinear_constitutive.py +1038 -0
- meep_gpu/cuda_kernels/test_offdiag_constitutive_pml_real.py +2315 -0
- meep_gpu/cuda_kernels/test_offdiag_stencil_welds.py +858 -0
- meep_gpu/cuda_kernels/test_own_cell_hoist_store_sequence.py +1248 -0
- meep_gpu/cuda_kernels/test_residual_fused_electric_pairs.py +451 -0
- meep_gpu/cuda_kernels/test_residual_fused_magnetic_pairs.py +574 -0
- meep_gpu/cuda_kernels/test_single_arm_launches.py +822 -0
- meep_gpu/cuda_kernels/test_special_kz_bfast_admission.py +260 -0
- meep_gpu/cuda_kernels/test_special_kz_curl.py +470 -0
- meep_gpu/cuda_kernels/test_special_kz_fused_hd_pair.py +284 -0
- meep_gpu/cuda_kernels/test_step_curl_pml_real.py +1662 -0
- meep_gpu/cuda_kernels/test_three_slot_dispersive_weld.py +570 -0
- meep_gpu/cuda_kernels/three_slot_dispersive_weld.py +778 -0
- meep_gpu/cuda_kernels/timing_cc86.json +1154 -0
- meep_gpu/cuda_kernels/timing_cc86.report.txt +64 -0
- meep_gpu/deposit_repair.py +1854 -0
- meep_gpu/device_identity.py +265 -0
- meep_gpu/dft.py +5538 -0
- meep_gpu/dispatch_preference.py +977 -0
- meep_gpu/dispersion.py +769 -0
- meep_gpu/driver.py +4617 -0
- meep_gpu/expansion_refusal.py +439 -0
- meep_gpu/fastpath.py +7652 -0
- meep_gpu/fastpath_cuda.py +2371 -0
- meep_gpu/fields.py +1957 -0
- meep_gpu/from_meep.py +8638 -0
- meep_gpu/gaussian_beam.py +303 -0
- meep_gpu/grid.py +1479 -0
- meep_gpu/harminv.py +680 -0
- meep_gpu/host_writes.py +331 -0
- meep_gpu/metal_dispatch.py +3120 -0
- meep_gpu/metal_kernels/__init__.py +104 -0
- meep_gpu/metal_kernels/ade_update_p.py +493 -0
- meep_gpu/metal_kernels/arms.py +289 -0
- meep_gpu/metal_kernels/barrier.py +367 -0
- meep_gpu/metal_kernels/beta_complex_fused_electric_pair.py +671 -0
- meep_gpu/metal_kernels/beta_complex_fused_hd_pair.py +1265 -0
- meep_gpu/metal_kernels/beta_complex_fused_magnetic_pair.py +549 -0
- meep_gpu/metal_kernels/beta_fused_electric_pair.py +640 -0
- meep_gpu/metal_kernels/beta_fused_magnetic_pair.py +573 -0
- meep_gpu/metal_kernels/beta_real_fused_hd_pair.py +1048 -0
- meep_gpu/metal_kernels/bfast_curl.py +1081 -0
- meep_gpu/metal_kernels/bfast_fused_electric_pair.py +681 -0
- meep_gpu/metal_kernels/bfast_fused_hd_pair.py +852 -0
- meep_gpu/metal_kernels/bfast_fused_magnetic_pair.py +568 -0
- meep_gpu/metal_kernels/coefficient_pack.py +201 -0
- meep_gpu/metal_kernels/complex_conductive_fused_pair.py +885 -0
- meep_gpu/metal_kernels/complex_conductive_pml.py +525 -0
- meep_gpu/metal_kernels/complex_dispersive_spine.py +173 -0
- meep_gpu/metal_kernels/complex_dispersive_update_e.py +300 -0
- meep_gpu/metal_kernels/complex_fields.py +1393 -0
- meep_gpu/metal_kernels/complex_folded_offdiag_update_e.py +365 -0
- meep_gpu/metal_kernels/complex_fused_ade_chain.py +825 -0
- meep_gpu/metal_kernels/complex_fused_electric_pair.py +920 -0
- meep_gpu/metal_kernels/complex_fused_hd_pair.py +1267 -0
- meep_gpu/metal_kernels/complex_fused_magnetic_pair.py +1010 -0
- meep_gpu/metal_kernels/complex_no_pml_conductive.py +446 -0
- meep_gpu/metal_kernels/complex_no_pml_curl.py +199 -0
- meep_gpu/metal_kernels/complex_no_pml_offdiag_fused_electric_pair.py +579 -0
- meep_gpu/metal_kernels/complex_no_pml_offdiag_update_e.py +391 -0
- meep_gpu/metal_kernels/complex_no_pml_stored_e.py +272 -0
- meep_gpu/metal_kernels/conductive_fused_electric_pair.py +675 -0
- meep_gpu/metal_kernels/conductive_fused_hd_pair.py +944 -0
- meep_gpu/metal_kernels/conductive_pml.py +273 -0
- meep_gpu/metal_kernels/corpus.py +170 -0
- meep_gpu/metal_kernels/coverage.py +631 -0
- meep_gpu/metal_kernels/cylindrical_complex.py +1780 -0
- meep_gpu/metal_kernels/cylindrical_complex_fused_hd_pair.py +841 -0
- meep_gpu/metal_kernels/cylindrical_complex_scan.py +273 -0
- meep_gpu/metal_kernels/cylindrical_fused_electric_pair.py +1073 -0
- meep_gpu/metal_kernels/cylindrical_fused_magnetic_pair.py +1087 -0
- meep_gpu/metal_kernels/cylindrical_real.py +1426 -0
- meep_gpu/metal_kernels/cylindrical_real_fused_electric_pair.py +1022 -0
- meep_gpu/metal_kernels/cylindrical_real_fused_hd_pair.py +955 -0
- meep_gpu/metal_kernels/cylindrical_real_fused_magnetic_pair.py +876 -0
- meep_gpu/metal_kernels/device.py +1659 -0
- meep_gpu/metal_kernels/dispersive_update_e.py +310 -0
- meep_gpu/metal_kernels/fingerprints.json +35997 -0
- meep_gpu/metal_kernels/folded_beta.py +1710 -0
- meep_gpu/metal_kernels/folded_beta_complex_fused_magnetic_pair.py +1443 -0
- meep_gpu/metal_kernels/folded_beta_complex_fused_pair.py +872 -0
- meep_gpu/metal_kernels/folded_beta_real_fused_magnetic_pair.py +638 -0
- meep_gpu/metal_kernels/folded_beta_real_fused_pair.py +670 -0
- meep_gpu/metal_kernels/folded_complex.py +1804 -0
- meep_gpu/metal_kernels/folded_complex_fused_hd_pair.py +889 -0
- meep_gpu/metal_kernels/folded_complex_fused_magnetic_pair.py +1918 -0
- meep_gpu/metal_kernels/folded_complex_fused_pair.py +1478 -0
- meep_gpu/metal_kernels/folded_complex_offdiag_fused_electric_pair.py +637 -0
- meep_gpu/metal_kernels/folded_dispersive_update_e.py +187 -0
- meep_gpu/metal_kernels/folded_fused_dispersive_pair.py +1043 -0
- meep_gpu/metal_kernels/folded_fused_hd_pair.py +796 -0
- meep_gpu/metal_kernels/folded_fused_magnetic_pair.py +1542 -0
- meep_gpu/metal_kernels/folded_fused_pair.py +1449 -0
- meep_gpu/metal_kernels/folded_offdiag_dispersive_update_e.py +457 -0
- meep_gpu/metal_kernels/folded_offdiag_fused_electric_pair.py +572 -0
- meep_gpu/metal_kernels/folded_offdiag_update_e.py +1422 -0
- meep_gpu/metal_kernels/fused_ade_chain.py +882 -0
- meep_gpu/metal_kernels/fused_dispersive_pair.py +821 -0
- meep_gpu/metal_kernels/fused_electric_pair.py +843 -0
- meep_gpu/metal_kernels/fused_hd_pair.py +1167 -0
- meep_gpu/metal_kernels/fused_magnetic_pair.py +765 -0
- meep_gpu/metal_kernels/launch.py +2125 -0
- meep_gpu/metal_kernels/no_pml_conductive.py +383 -0
- meep_gpu/metal_kernels/no_pml_conductive_fused_electric_pair.py +797 -0
- meep_gpu/metal_kernels/no_pml_constitutive.py +737 -0
- meep_gpu/metal_kernels/no_pml_curl.py +339 -0
- meep_gpu/metal_kernels/no_pml_fused_electric_pair.py +553 -0
- meep_gpu/metal_kernels/no_pml_stored_e.py +285 -0
- meep_gpu/metal_kernels/nonlinear_fused_magnetic_pair.py +305 -0
- meep_gpu/metal_kernels/nonlinear_update_e.py +1575 -0
- meep_gpu/metal_kernels/offdiag_fused_electric_pair.py +720 -0
- meep_gpu/metal_kernels/offdiag_update_e.py +1134 -0
- meep_gpu/metal_kernels/offdiag_weld_common.py +588 -0
- meep_gpu/metal_kernels/plans.py +90 -0
- meep_gpu/metal_kernels/preconditions.py +265 -0
- meep_gpu/metal_kernels/registry.py +385 -0
- meep_gpu/metal_kernels/shaders.py +430 -0
- meep_gpu/metal_kernels/special_kz.py +1804 -0
- meep_gpu/metal_kernels/subnormal.py +313 -0
- meep_gpu/metal_kernels/symmetry.py +1829 -0
- meep_gpu/metal_kernels/templates.py +224 -0
- meep_gpu/metal_runs.py +329 -0
- meep_gpu/pml.py +857 -0
- meep_gpu/sigma_lookup.py +327 -0
- meep_gpu/sigma_recovery.py +261 -0
- meep_gpu/smoothing.py +1440 -0
- meep_gpu/sources.py +2272 -0
- meep_gpu/stepping.py +2544 -0
- meep_gpu/subnormal_policy.py +2332 -0
- meep_gpu/test_absorber.py +311 -0
- meep_gpu/test_backends.py +311 -0
- meep_gpu/test_bytecode_cache_matches_source.py +117 -0
- meep_gpu/test_capability_records.py +667 -0
- meep_gpu/test_code_identity.py +148 -0
- meep_gpu/test_compile_cache_consistency.py +122 -0
- meep_gpu/test_conftest_guards.py +281 -0
- meep_gpu/test_cuda_certified_fused_products.py +1072 -0
- meep_gpu/test_cuda_complex_fused_hd_pair.py +464 -0
- meep_gpu/test_cuda_cylindrical_fused_hd_pair.py +268 -0
- meep_gpu/test_cuda_cylindrical_real_fused_hd_pair.py +284 -0
- meep_gpu/test_cuda_weld_contract.py +1760 -0
- meep_gpu/test_cylindrical.py +727 -0
- meep_gpu/test_cylindrical_near2far.py +626 -0
- meep_gpu/test_deposit_repair.py +1227 -0
- meep_gpu/test_deposit_repair_component_restriction.py +1867 -0
- meep_gpu/test_deposit_repair_linear_route.py +817 -0
- meep_gpu/test_deposit_repair_restriction_bench_record.py +156 -0
- meep_gpu/test_device_identity.py +159 -0
- meep_gpu/test_dft.py +3829 -0
- meep_gpu/test_diagonal_epsilon.py +180 -0
- meep_gpu/test_dispatch_contract.py +5493 -0
- meep_gpu/test_dispatch_expansion_refusal.py +1033 -0
- meep_gpu/test_dispatch_policy_uniformity.py +584 -0
- meep_gpu/test_dispatch_preference.py +1008 -0
- meep_gpu/test_dispatch_route_tables_are_complete.py +86 -0
- meep_gpu/test_dispatch_subnormal_gate.py +426 -0
- meep_gpu/test_dispersion.py +1057 -0
- meep_gpu/test_driver_integration.py +4886 -0
- meep_gpu/test_driver_vs_meep.py +5330 -0
- meep_gpu/test_fastpath.py +618 -0
- meep_gpu/test_field_reducers.py +633 -0
- meep_gpu/test_fields.py +1237 -0
- meep_gpu/test_folded_deposit_closure.py +192 -0
- meep_gpu/test_folded_fused_pair_routing.py +822 -0
- meep_gpu/test_from_meep.py +8694 -0
- meep_gpu/test_fused_pair_deposit_wiring.py +2543 -0
- meep_gpu/test_gate_provenance.py +336 -0
- meep_gpu/test_gaussian_beam.py +392 -0
- meep_gpu/test_grid_pml.py +1498 -0
- meep_gpu/test_harminv.py +1404 -0
- meep_gpu/test_meep_precision_notice.py +173 -0
- meep_gpu/test_metal_ade_update_p.py +332 -0
- meep_gpu/test_metal_artifact_provenance.py +1011 -0
- meep_gpu/test_metal_below_the_cut_fused_pairs.py +749 -0
- meep_gpu/test_metal_beta_complex_fused_hd_pair.py +571 -0
- meep_gpu/test_metal_beta_real_fused_hd_pair.py +546 -0
- meep_gpu/test_metal_bfast.py +803 -0
- meep_gpu/test_metal_bfast_fused_hd_pair.py +421 -0
- meep_gpu/test_metal_coefficient_pack.py +223 -0
- meep_gpu/test_metal_complex_conductive_fused_pair.py +412 -0
- meep_gpu/test_metal_complex_conductive_pml.py +284 -0
- meep_gpu/test_metal_complex_dispersive_update_e.py +195 -0
- meep_gpu/test_metal_complex_fields.py +818 -0
- meep_gpu/test_metal_complex_folded_offdiag_update_e.py +131 -0
- meep_gpu/test_metal_complex_fused_ade_chain.py +341 -0
- meep_gpu/test_metal_complex_fused_hd_pair.py +668 -0
- meep_gpu/test_metal_complex_fused_magnetic_pair.py +549 -0
- meep_gpu/test_metal_complex_no_pml_conductive.py +226 -0
- meep_gpu/test_metal_complex_no_pml_curl.py +220 -0
- meep_gpu/test_metal_complex_no_pml_offdiag_update_e.py +167 -0
- meep_gpu/test_metal_complex_no_pml_stored_e.py +162 -0
- meep_gpu/test_metal_conductive_fused_hd_pair.py +527 -0
- meep_gpu/test_metal_conductive_pml.py +174 -0
- meep_gpu/test_metal_cylindrical_complex.py +1132 -0
- meep_gpu/test_metal_cylindrical_complex_fused_hd_pair.py +378 -0
- meep_gpu/test_metal_cylindrical_complex_scan.py +367 -0
- meep_gpu/test_metal_cylindrical_fused_electric_pair.py +612 -0
- meep_gpu/test_metal_cylindrical_fused_magnetic_pair.py +453 -0
- meep_gpu/test_metal_cylindrical_real.py +721 -0
- meep_gpu/test_metal_cylindrical_real_fused_electric_pair.py +912 -0
- meep_gpu/test_metal_cylindrical_real_fused_hd_pair.py +397 -0
- meep_gpu/test_metal_cylindrical_real_fused_magnetic_pair.py +678 -0
- meep_gpu/test_metal_dispatch.py +1096 -0
- meep_gpu/test_metal_dispersive_update_e.py +147 -0
- meep_gpu/test_metal_environment.py +316 -0
- meep_gpu/test_metal_folded_beta.py +1043 -0
- meep_gpu/test_metal_folded_complex.py +1353 -0
- meep_gpu/test_metal_folded_complex_fused_hd_pair.py +566 -0
- meep_gpu/test_metal_folded_complex_fused_magnetic_pair.py +590 -0
- meep_gpu/test_metal_folded_dispersive_update_e.py +139 -0
- meep_gpu/test_metal_folded_fused_hd_pair.py +953 -0
- meep_gpu/test_metal_folded_fused_magnetic_pair.py +507 -0
- meep_gpu/test_metal_folded_fused_pair.py +425 -0
- meep_gpu/test_metal_folded_offdiag.py +1194 -0
- meep_gpu/test_metal_folded_offdiag_dispersive_update_e.py +128 -0
- meep_gpu/test_metal_fused_ade_chain.py +420 -0
- meep_gpu/test_metal_fused_dispersive_pair.py +331 -0
- meep_gpu/test_metal_fused_electric_pair.py +447 -0
- meep_gpu/test_metal_fused_hd_pair.py +1546 -0
- meep_gpu/test_metal_fused_hd_pair_nonlinear.py +420 -0
- meep_gpu/test_metal_fused_magnetic_pair.py +365 -0
- meep_gpu/test_metal_fused_pair_deposit_wiring.py +1177 -0
- meep_gpu/test_metal_held_fallback.py +706 -0
- meep_gpu/test_metal_kernels.py +624 -0
- meep_gpu/test_metal_no_pml_conductive.py +219 -0
- meep_gpu/test_metal_no_pml_constitutive.py +1470 -0
- meep_gpu/test_metal_no_pml_curl.py +197 -0
- meep_gpu/test_metal_no_pml_fused_electric_pairs.py +535 -0
- meep_gpu/test_metal_no_pml_stored_e.py +174 -0
- meep_gpu/test_metal_nonlinear_update_e.py +820 -0
- meep_gpu/test_metal_offdiag.py +798 -0
- meep_gpu/test_metal_offdiag_stencil_welds.py +505 -0
- meep_gpu/test_metal_planner_composition.py +646 -0
- meep_gpu/test_metal_residency_barrier.py +246 -0
- meep_gpu/test_metal_residency_ownership.py +913 -0
- meep_gpu/test_metal_residue_fused_pairs.py +348 -0
- meep_gpu/test_metal_runs.py +294 -0
- meep_gpu/test_metal_special_kz.py +999 -0
- meep_gpu/test_metal_symmetry.py +1190 -0
- meep_gpu/test_metal_weld_contract.py +1013 -0
- meep_gpu/test_package_boundary.py +441 -0
- meep_gpu/test_prefer_gpu.py +799 -0
- meep_gpu/test_regate_writers.py +1078 -0
- meep_gpu/test_sigma_lookup.py +916 -0
- meep_gpu/test_sigma_recovery.py +689 -0
- meep_gpu/test_smoothing.py +2389 -0
- meep_gpu/test_sources.py +2493 -0
- meep_gpu/test_stepping.py +3420 -0
- meep_gpu/test_subnormal_policy.py +2184 -0
- meep_gpu/test_sync_pass_channel.py +578 -0
- meep_gpu/test_tensor_epsilon.py +562 -0
- meep_gpu/test_triton_beta_fused_electric_pair.py +669 -0
- meep_gpu/test_triton_beta_fused_magnetic_pair.py +363 -0
- meep_gpu/test_triton_bfast.py +1339 -0
- meep_gpu/test_triton_bfast_fused_electric_pair.py +657 -0
- meep_gpu/test_triton_bfast_fused_magnetic_pair.py +358 -0
- meep_gpu/test_triton_certified_fused_products.py +1409 -0
- meep_gpu/test_triton_complex_ade.py +291 -0
- meep_gpu/test_triton_complex_beta_fused_electric_pair.py +391 -0
- meep_gpu/test_triton_complex_beta_fused_magnetic_pair.py +407 -0
- meep_gpu/test_triton_complex_conductive_fused_pair.py +512 -0
- meep_gpu/test_triton_complex_fields.py +2900 -0
- meep_gpu/test_triton_complex_fused_ade_chain.py +700 -0
- meep_gpu/test_triton_complex_fused_electric_pair.py +856 -0
- meep_gpu/test_triton_complex_fused_hd_pair.py +747 -0
- meep_gpu/test_triton_complex_fused_magnetic_pair.py +857 -0
- meep_gpu/test_triton_complex_no_pml_conductive.py +301 -0
- meep_gpu/test_triton_complex_no_pml_curl.py +699 -0
- meep_gpu/test_triton_complex_no_pml_stored_e.py +394 -0
- meep_gpu/test_triton_complex_offdiag_update_e.py +306 -0
- meep_gpu/test_triton_conductive_fused_electric_pair.py +792 -0
- meep_gpu/test_triton_conductivity.py +628 -0
- meep_gpu/test_triton_cylindrical.py +669 -0
- meep_gpu/test_triton_cylindrical_complex.py +2523 -0
- meep_gpu/test_triton_cylindrical_composition.py +253 -0
- meep_gpu/test_triton_cylindrical_fused_electric_pair.py +695 -0
- meep_gpu/test_triton_cylindrical_fused_hd_pair.py +578 -0
- meep_gpu/test_triton_cylindrical_fused_magnetic_pair.py +440 -0
- meep_gpu/test_triton_cylindrical_real_fused_electric_pair.py +760 -0
- meep_gpu/test_triton_cylindrical_real_fused_hd_pair.py +675 -0
- meep_gpu/test_triton_cylindrical_real_fused_magnetic_pair.py +529 -0
- meep_gpu/test_triton_device_identity.py +142 -0
- meep_gpu/test_triton_dispersive_fused_pair.py +365 -0
- meep_gpu/test_triton_dispersive_update_e.py +682 -0
- meep_gpu/test_triton_folded_beta_complex_fused_magnetic_pair.py +698 -0
- meep_gpu/test_triton_folded_beta_complex_fused_pair.py +649 -0
- meep_gpu/test_triton_folded_beta_fused_electric_pair.py +617 -0
- meep_gpu/test_triton_folded_beta_fused_magnetic_pair.py +546 -0
- meep_gpu/test_triton_folded_complex.py +3538 -0
- meep_gpu/test_triton_folded_complex_fused_magnetic_pair.py +1377 -0
- meep_gpu/test_triton_folded_complex_fused_pair.py +1349 -0
- meep_gpu/test_triton_folded_complex_offdiag_admission.py +543 -0
- meep_gpu/test_triton_folded_dispersive_fused_pair.py +873 -0
- meep_gpu/test_triton_folded_dispersive_update_e.py +460 -0
- meep_gpu/test_triton_folded_fused_hd_pair.py +810 -0
- meep_gpu/test_triton_folded_fused_magnetic_pair.py +1088 -0
- meep_gpu/test_triton_folded_fused_pair.py +1129 -0
- meep_gpu/test_triton_folded_offdiag_dispersive_update_e.py +385 -0
- meep_gpu/test_triton_folded_offdiag_fused_ade_chain.py +987 -0
- meep_gpu/test_triton_folded_offdiag_fused_electric_pair.py +604 -0
- meep_gpu/test_triton_folded_offdiag_update_e.py +1217 -0
- meep_gpu/test_triton_fused_ade_chain.py +665 -0
- meep_gpu/test_triton_fused_ade_state.py +256 -0
- meep_gpu/test_triton_fused_dispersive_chain.py +489 -0
- meep_gpu/test_triton_fused_hd_pair.py +827 -0
- meep_gpu/test_triton_hd_tail_products.py +650 -0
- meep_gpu/test_triton_kernels.py +1580 -0
- meep_gpu/test_triton_no_pml.py +819 -0
- meep_gpu/test_triton_no_pml_ade.py +553 -0
- meep_gpu/test_triton_no_pml_conductive.py +686 -0
- meep_gpu/test_triton_no_pml_constitutive.py +2310 -0
- meep_gpu/test_triton_no_pml_fused_electric_pair.py +775 -0
- meep_gpu/test_triton_no_pml_stored_e.py +515 -0
- meep_gpu/test_triton_nonlinear_fused_magnetic_pair.py +292 -0
- meep_gpu/test_triton_nonlinear_update_e.py +1187 -0
- meep_gpu/test_triton_offdiag_fused_electric_pair.py +662 -0
- meep_gpu/test_triton_offdiag_update_e.py +1041 -0
- meep_gpu/test_triton_planner_composition.py +4064 -0
- meep_gpu/test_triton_residual_group_wiring.py +503 -0
- meep_gpu/test_triton_residual_probe_discipline.py +401 -0
- meep_gpu/test_triton_source_seams.py +261 -0
- meep_gpu/test_triton_special_kz.py +1142 -0
- meep_gpu/test_triton_symmetry.py +548 -0
- meep_gpu/test_triton_symmetry_composition.py +252 -0
- meep_gpu/test_triton_weld_contract.py +2365 -0
- meep_gpu/test_uncertified_opt_in.py +1032 -0
- meep_gpu/test_version.py +87 -0
- meep_gpu/test_weld_record_walk.py +504 -0
- meep_gpu/test_withdraw_hoist.py +600 -0
- meep_gpu/triton_kernels/__init__.py +959 -0
- meep_gpu/triton_kernels/beta_complex_fused_hd_pair.py +1376 -0
- meep_gpu/triton_kernels/beta_fused_electric_pair.py +755 -0
- meep_gpu/triton_kernels/beta_fused_magnetic_pair.py +648 -0
- meep_gpu/triton_kernels/beta_real_fused_hd_pair.py +1118 -0
- meep_gpu/triton_kernels/bfast_curl.py +1032 -0
- meep_gpu/triton_kernels/bfast_fused_electric_pair.py +782 -0
- meep_gpu/triton_kernels/bfast_fused_magnetic_pair.py +697 -0
- meep_gpu/triton_kernels/complex_ade.py +400 -0
- meep_gpu/triton_kernels/complex_beta_fused_electric_pair.py +880 -0
- meep_gpu/triton_kernels/complex_beta_fused_magnetic_pair.py +838 -0
- meep_gpu/triton_kernels/complex_conductive_fused_pair.py +892 -0
- meep_gpu/triton_kernels/complex_fields.py +2295 -0
- meep_gpu/triton_kernels/complex_fused_ade_chain.py +1118 -0
- meep_gpu/triton_kernels/complex_fused_electric_pair.py +1038 -0
- meep_gpu/triton_kernels/complex_fused_hd_pair.py +1558 -0
- meep_gpu/triton_kernels/complex_fused_magnetic_pair.py +867 -0
- meep_gpu/triton_kernels/complex_no_pml_conductive.py +497 -0
- meep_gpu/triton_kernels/complex_no_pml_curl.py +415 -0
- meep_gpu/triton_kernels/complex_no_pml_stored_e.py +432 -0
- meep_gpu/triton_kernels/complex_offdiag_update_e.py +639 -0
- meep_gpu/triton_kernels/conductive_bfast_fused_hd_pair.py +1255 -0
- meep_gpu/triton_kernels/conductive_fused_electric_pair.py +868 -0
- meep_gpu/triton_kernels/conductivity.py +810 -0
- meep_gpu/triton_kernels/coverage.py +761 -0
- meep_gpu/triton_kernels/cylindrical_complex.py +1718 -0
- meep_gpu/triton_kernels/cylindrical_fused_electric_pair.py +1284 -0
- meep_gpu/triton_kernels/cylindrical_fused_hd_pair.py +882 -0
- meep_gpu/triton_kernels/cylindrical_fused_magnetic_pair.py +1071 -0
- meep_gpu/triton_kernels/cylindrical_real_fused_electric_pair.py +750 -0
- meep_gpu/triton_kernels/cylindrical_real_fused_hd_pair.py +745 -0
- meep_gpu/triton_kernels/cylindrical_real_fused_magnetic_pair.py +744 -0
- meep_gpu/triton_kernels/cylindrical_triton.py +983 -0
- meep_gpu/triton_kernels/dispersive_fused_pair.py +451 -0
- meep_gpu/triton_kernels/dispersive_update_e.py +719 -0
- meep_gpu/triton_kernels/fingerprints.json +8359 -0
- meep_gpu/triton_kernels/folded_beta_complex_fused_magnetic_pair.py +1470 -0
- meep_gpu/triton_kernels/folded_beta_complex_fused_pair.py +1764 -0
- meep_gpu/triton_kernels/folded_beta_fused_electric_pair.py +1031 -0
- meep_gpu/triton_kernels/folded_beta_fused_magnetic_pair.py +919 -0
- meep_gpu/triton_kernels/folded_complex.py +3244 -0
- meep_gpu/triton_kernels/folded_complex_fused_hd_pair.py +1187 -0
- meep_gpu/triton_kernels/folded_complex_fused_magnetic_pair.py +1747 -0
- meep_gpu/triton_kernels/folded_complex_fused_pair.py +1905 -0
- meep_gpu/triton_kernels/folded_dispersive_fused_pair.py +1200 -0
- meep_gpu/triton_kernels/folded_dispersive_update_e.py +340 -0
- meep_gpu/triton_kernels/folded_fused_hd_pair.py +991 -0
- meep_gpu/triton_kernels/folded_fused_magnetic_pair.py +1171 -0
- meep_gpu/triton_kernels/folded_fused_pair.py +1408 -0
- meep_gpu/triton_kernels/folded_offdiag_dispersive_update_e.py +587 -0
- meep_gpu/triton_kernels/folded_offdiag_fused_ade_chain.py +1238 -0
- meep_gpu/triton_kernels/folded_offdiag_fused_electric_pair.py +1124 -0
- meep_gpu/triton_kernels/folded_offdiag_update_e.py +1396 -0
- meep_gpu/triton_kernels/fused_ade_chain.py +1299 -0
- meep_gpu/triton_kernels/fused_ade_state.py +315 -0
- meep_gpu/triton_kernels/fused_dispersive_chain.py +673 -0
- meep_gpu/triton_kernels/fused_hd_pair.py +1200 -0
- meep_gpu/triton_kernels/kernels.py +728 -0
- meep_gpu/triton_kernels/launch.py +4402 -0
- meep_gpu/triton_kernels/no_pml.py +819 -0
- meep_gpu/triton_kernels/no_pml_ade.py +413 -0
- meep_gpu/triton_kernels/no_pml_conductive.py +943 -0
- meep_gpu/triton_kernels/no_pml_constitutive.py +889 -0
- meep_gpu/triton_kernels/no_pml_fused_electric_pair.py +1043 -0
- meep_gpu/triton_kernels/no_pml_stored_e.py +759 -0
- meep_gpu/triton_kernels/nonlinear_fused_hd_pair.py +473 -0
- meep_gpu/triton_kernels/nonlinear_fused_magnetic_pair.py +392 -0
- meep_gpu/triton_kernels/nonlinear_update_e.py +1384 -0
- meep_gpu/triton_kernels/offdiag_fused_electric_pair.py +994 -0
- meep_gpu/triton_kernels/offdiag_scratch_weld.py +366 -0
- meep_gpu/triton_kernels/offdiag_update_e.py +958 -0
- meep_gpu/triton_kernels/special_kz.py +1637 -0
- meep_gpu/triton_kernels/symmetry.py +1190 -0
- meep_gpu/triton_kernels/timing_cc86.json +2375 -0
- meep_gpu/triton_kernels/timing_cc86.report.txt +93 -0
- meep_gpu/weld_record_walk.py +646 -0
- meep_gpu/withdraw_hoist.py +581 -0
- meep_gpu-0.9.2.dist-info/METADATA +652 -0
- meep_gpu-0.9.2.dist-info/RECORD +537 -0
- meep_gpu-0.9.2.dist-info/WHEEL +5 -0
- meep_gpu-0.9.2.dist-info/licenses/LICENSE +339 -0
- meep_gpu-0.9.2.dist-info/licenses/NOTICE +21 -0
- meep_gpu-0.9.2.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,675 @@
|
|
|
1
|
+
"""Laptop contracts for the Triton Dcyl m = 0 REAL H->D product:
|
|
2
|
+
``triton_kernels/cylindrical_real_fused_hd_pair.py``.
|
|
3
|
+
|
|
4
|
+
The device gate (``parity/meep_gpu/gate_triton_cylindrical_real_fused_hd_pair.py``) is
|
|
5
|
+
what certifies the bytes; this suite is the merge bar. It holds what would otherwise be
|
|
6
|
+
true only on a machine nobody runs on the way in:
|
|
7
|
+
|
|
8
|
+
* the declarations DESCRIBE the seam, the oracle and the wiring rather than request
|
|
9
|
+
them -- the pool tags, the ``ir0`` and the row vectors' key are read off
|
|
10
|
+
``stepping.py``'s own text, the prefix component off the certified family's table;
|
|
11
|
+
* the increment's spelling is pinned statement by statement, and the one spelling this
|
|
12
|
+
backend must NOT use (``/``, which lowers to ``div.full.f32``) is refused by name;
|
|
13
|
+
* the constitutive half is IMPORTED from the certified Cartesian weld, whose lift is
|
|
14
|
+
re-asserted here because this product launches it;
|
|
15
|
+
* the predicate's refusals BY NAME, on real Dcyl objects on NumPy;
|
|
16
|
+
* the plan's aliasing refusals and its rotation contract;
|
|
17
|
+
* the composer is offered this product (routed 2026-09-07: the composer's, the
|
|
18
|
+
dispatcher's and the board's tables all carry it) and refuses it by its own
|
|
19
|
+
``INSTALLABLE = False``, with the reason read off the tree;
|
|
20
|
+
* the gate's host legs pass here, every mutation needle resolves exactly once, and the
|
|
21
|
+
lift leg's cell is the seam record's own.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import ast
|
|
27
|
+
import importlib
|
|
28
|
+
import inspect
|
|
29
|
+
import pathlib
|
|
30
|
+
import re
|
|
31
|
+
import sys
|
|
32
|
+
|
|
33
|
+
import numpy
|
|
34
|
+
import pytest
|
|
35
|
+
|
|
36
|
+
from .fields import Fields, StepScratch
|
|
37
|
+
from .grid import Grid
|
|
38
|
+
from .pml import PML
|
|
39
|
+
|
|
40
|
+
HERE = pathlib.Path(__file__).parent
|
|
41
|
+
PACKAGE_DIR = HERE / "triton_kernels"
|
|
42
|
+
PARITY = HERE.parent / "parity" / "meep_gpu"
|
|
43
|
+
MODULE = "meep_gpu.triton_kernels.cylindrical_real_fused_hd_pair"
|
|
44
|
+
FAMILY = "cylindrical_real_fused_hd_pair"
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@pytest.fixture(scope="module")
|
|
48
|
+
def product():
|
|
49
|
+
return importlib.import_module(MODULE)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@pytest.fixture(scope="module")
|
|
53
|
+
def gate():
|
|
54
|
+
for path in (str(PARITY), str(HERE.parent)):
|
|
55
|
+
if path not in sys.path:
|
|
56
|
+
sys.path.insert(0, path)
|
|
57
|
+
return importlib.import_module("gate_triton_cylindrical_real_fused_hd_pair")
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
# ---------------------------------------------------------------------------
|
|
61
|
+
# Fixtures -- real Dcyl Grid/Fields/PML on NumPy
|
|
62
|
+
# ---------------------------------------------------------------------------
|
|
63
|
+
|
|
64
|
+
def build(cell=(1.2, 0.0, 1.6), resolution=10.0, courant=0.35, m=0,
|
|
65
|
+
force_complex_fields=False, thickness=0.3):
|
|
66
|
+
grid = Grid(resolution=resolution, cell_size=cell, cylindrical=True, m=m,
|
|
67
|
+
boundaries={"z": "metallic"}, courant=courant)
|
|
68
|
+
fields = Fields(grid=grid, force_complex_fields=force_complex_fields)
|
|
69
|
+
fields.set_background_eps(2.25)
|
|
70
|
+
if thickness:
|
|
71
|
+
fields.enable_pml_storage()
|
|
72
|
+
else:
|
|
73
|
+
fields.enable_field_storage()
|
|
74
|
+
pml = PML(grid=grid, thickness=({"x": (0, thickness), "z": thickness}
|
|
75
|
+
if thickness else 0))
|
|
76
|
+
return fields, pml
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
def _reasons(verdict):
|
|
80
|
+
"""The refusal reasons MINUS the array-module clause (a NumPy host always fires it)."""
|
|
81
|
+
return [reason for reason in verdict.reasons if "not cupy" not in reason]
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
class _Electric:
|
|
85
|
+
from . import sources as _sources_module
|
|
86
|
+
|
|
87
|
+
withdraw = _sources_module.VolumeSource.withdraw
|
|
88
|
+
field_type = "D"
|
|
89
|
+
component = "Ez"
|
|
90
|
+
is_integrated = True
|
|
91
|
+
_n_source_points = 3
|
|
92
|
+
_applied_dipole = 0j
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class _NonIntegratedElectric(_Electric):
|
|
96
|
+
is_integrated = False
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
class _Magnetic(_Electric):
|
|
100
|
+
field_type = "B"
|
|
101
|
+
component = "Hz"
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
class _View:
|
|
105
|
+
"""One object with attributes overridden, everything else forwarded."""
|
|
106
|
+
|
|
107
|
+
def __init__(self, inner, **overrides):
|
|
108
|
+
object.__setattr__(self, "_inner", inner)
|
|
109
|
+
object.__setattr__(self, "_overrides", dict(overrides))
|
|
110
|
+
|
|
111
|
+
def __getattr__(self, name):
|
|
112
|
+
overrides = object.__getattribute__(self, "_overrides")
|
|
113
|
+
if name in overrides:
|
|
114
|
+
return overrides[name]
|
|
115
|
+
return getattr(object.__getattribute__(self, "_inner"), name)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
# ---------------------------------------------------------------------------
|
|
119
|
+
# Declarations
|
|
120
|
+
# ---------------------------------------------------------------------------
|
|
121
|
+
|
|
122
|
+
def test_the_product_declares_the_seam_it_replaces(product):
|
|
123
|
+
assert product.REPLACES == ("update_H", "step_D")
|
|
124
|
+
assert product.SLOT == "update_H"
|
|
125
|
+
assert product.CONSTITUTIVE_SIDE == "H"
|
|
126
|
+
assert product.CURL_SUB_STEP == "step_D"
|
|
127
|
+
assert product.ARMS == ("cylindrical", "cylindrical PML")
|
|
128
|
+
assert product.BACKWARD == 1
|
|
129
|
+
assert product.ROTATED == ("Hx", "Hy", "Hz", "f_w_Hx", "f_w_Hy", "f_w_Hz")
|
|
130
|
+
assert product.IN_PLACE == ("Dx", "Dy", "Dz", "fu_Dx", "fu_Dy", "fu_Dz")
|
|
131
|
+
assert product.LAUNCHES_PER_RUN == 3
|
|
132
|
+
assert product.KERNEL_LAUNCHES_PER_RUN == 2
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def test_replaces_is_the_drivers_own_two_adjacent_consults(product):
|
|
136
|
+
from . import driver as driver_module
|
|
137
|
+
|
|
138
|
+
source = inspect.getsource(driver_module.FdtdDriver.step)
|
|
139
|
+
order = [line.split('fast.dispatch("', 1)[1].split('"', 1)[0]
|
|
140
|
+
for line in source.splitlines() if 'fast.dispatch("' in line]
|
|
141
|
+
first = order.index("update_H")
|
|
142
|
+
assert order[first:first + 2] == list(product.REPLACES)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
def test_the_only_statement_in_the_seam_is_the_electric_withdraw(product):
|
|
146
|
+
from . import driver as driver_module
|
|
147
|
+
|
|
148
|
+
source = inspect.getsource(driver_module.FdtdDriver.step)
|
|
149
|
+
between = source.split('fast.dispatch("update_H"', 1)[1]
|
|
150
|
+
between = between.split('fast.dispatch("step_D"', 1)[0]
|
|
151
|
+
statements = [line.strip() for line in between.splitlines()
|
|
152
|
+
if line.strip() and not line.strip().startswith("#")
|
|
153
|
+
and "update_H(self.fields" not in line]
|
|
154
|
+
assert any("withdraw" in line for line in statements), statements
|
|
155
|
+
assert not any("inject" in line for line in statements), statements
|
|
156
|
+
assert product.CARRIES_DEPOSIT_REPAIR is False
|
|
157
|
+
assert product.REPAIR_PATHS == ()
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def test_the_seam_name_is_the_withdraw_hoists_and_the_span_is_its_own(product):
|
|
161
|
+
from . import withdraw_hoist
|
|
162
|
+
|
|
163
|
+
assert product.SEAM == withdraw_hoist.SEAM
|
|
164
|
+
assert product.REPLACES == withdraw_hoist.SEAM_SPAN
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
def test_the_two_flags_and_the_wiring_move_together(product):
|
|
168
|
+
"""``HOISTS_THE_WITHDRAW`` False is entailed by ``INSTALLABLE`` False, and the reason
|
|
169
|
+
names the label boundary, the cylindrical launch algebra AND its own gate."""
|
|
170
|
+
assert product.INSTALLABLE is False
|
|
171
|
+
assert product.HOISTS_THE_WITHDRAW is False
|
|
172
|
+
assert "4 - (installed pairs)" in product.INSTALLABLE_REASON
|
|
173
|
+
assert "SEVEN" in product.INSTALLABLE_REASON and "THREE" in product.INSTALLABLE_REASON
|
|
174
|
+
assert "gate_triton_cylindrical_real_fused_hd_pair.py" in product.INSTALLABLE_REASON
|
|
175
|
+
assert "dispatch_reachability" in product.INSTALLABLE_REASON
|
|
176
|
+
# THE ONE-WAY RULE: nothing in this package may know a dispatcher exists.
|
|
177
|
+
assert "fastpath" not in product.INSTALLABLE_REASON
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
def test_the_module_is_ascii(product):
|
|
181
|
+
assert pathlib.Path(product.__file__).read_text(encoding="utf-8").isascii()
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
# ---------------------------------------------------------------------------
|
|
185
|
+
# The oracle, read off stepping.py
|
|
186
|
+
# ---------------------------------------------------------------------------
|
|
187
|
+
|
|
188
|
+
def _stepping_text():
|
|
189
|
+
return (HERE / "stepping.py").read_text(encoding="utf-8")
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def test_the_prefix_declaration_is_step_Ds_own(product):
|
|
193
|
+
"""``Hy`` at ``ir0 = 0.5``, fed to ``Dz`` only -- read off ``stepping.step_D``."""
|
|
194
|
+
from .triton_kernels import cylindrical_triton
|
|
195
|
+
|
|
196
|
+
step_d = _stepping_text().split("def step_D(", 1)[1].split("\ndef ", 1)[0]
|
|
197
|
+
assert 'prefixed["Hy"] = cylindrical_rderiv_prefix(grid.xp, magnetic["Hy"], 0.5' in step_d
|
|
198
|
+
assert 'if cylindrical and term.target == "Dz":' in step_d
|
|
199
|
+
assert product.PREFIX_COMPONENT == "Hy"
|
|
200
|
+
assert product.PREFIX_IR0 == 0.5
|
|
201
|
+
spec = cylindrical_triton.SUB_STEPS["step_D"]
|
|
202
|
+
assert (spec["prefix_component"], spec["prefix_ir0"]) == ("Hy", 0.5)
|
|
203
|
+
assert spec["extend_wall_row"] is False
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def test_the_pool_tags_and_the_row_vector_key_are_the_oracles_own(product):
|
|
207
|
+
"""The plan takes the SAME pooled slots and the SAME cached constants the shipped
|
|
208
|
+
``cylindrical_rderiv_prefix`` uses, so the scan writes where the oracle writes."""
|
|
209
|
+
scan = _stepping_text().split("def cylindrical_rderiv_prefix(", 1)[1].split("\ndef ", 1)[0]
|
|
210
|
+
assert f'scratch.take("{product.INCREMENT_TAG}"' in scan
|
|
211
|
+
assert f'scratch.take("{product.PREFIX_TAG}"' in scan
|
|
212
|
+
assert 'key = ("cyl_rderiv", int(f_p.shape[0]), float(ir0), real_dtype)' in scan
|
|
213
|
+
assert product.rderiv_constant_key(12, numpy.dtype("float32")) == (
|
|
214
|
+
"cyl_rderiv", 12, 0.5, numpy.dtype("float32"))
|
|
215
|
+
# The four elementwise statements the kernel replaces, in the oracle's order.
|
|
216
|
+
order = [scan.index(needle) for needle in (
|
|
217
|
+
"xp.multiply(f_p, weights, out=weighted)",
|
|
218
|
+
"increment[_face(0, 0)] = 0",
|
|
219
|
+
"xp.subtract(weighted[1:], weighted[:-1], out=increment[1:])",
|
|
220
|
+
"increment[1:] /= divisor",
|
|
221
|
+
"xp.cumsum(increment, axis=0,")]
|
|
222
|
+
assert order == sorted(order)
|
|
223
|
+
|
|
224
|
+
|
|
225
|
+
def test_the_row_vectors_are_bound_from_the_pool_not_rebuilt(product):
|
|
226
|
+
scratch = StepScratch(numpy)
|
|
227
|
+
from .stepping import _cylindrical_rderiv_weights
|
|
228
|
+
|
|
229
|
+
expected = scratch.constant(product.rderiv_constant_key(9, numpy.dtype("float32")),
|
|
230
|
+
lambda: _cylindrical_rderiv_weights(numpy, 9, 0.5,
|
|
231
|
+
numpy.dtype("float32")))
|
|
232
|
+
weights, divisor = product.rderiv_vectors(numpy, scratch, 9, numpy.dtype("float32"))
|
|
233
|
+
assert weights is expected[0] and divisor is expected[1]
|
|
234
|
+
assert weights.shape == (9, 1, 1) and divisor.shape == (8, 1, 1)
|
|
235
|
+
# The D-side ladder: weights (ir + 0.5), divisor ir for ir = 1..nr-1.
|
|
236
|
+
assert numpy.array_equal(weights.reshape(-1), (numpy.arange(9) + 0.5).astype(numpy.float32))
|
|
237
|
+
assert numpy.array_equal(divisor.reshape(-1), numpy.arange(1, 9).astype(numpy.float32))
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
# ---------------------------------------------------------------------------
|
|
241
|
+
# The increment's spelling, statement by statement
|
|
242
|
+
# ---------------------------------------------------------------------------
|
|
243
|
+
|
|
244
|
+
def test_every_increment_statement_appears_exactly_once_in_the_kernel(product):
|
|
245
|
+
statements = product.increment_statements()
|
|
246
|
+
assert len(statements) >= 30
|
|
247
|
+
for tag, needle in product.INCREMENT_SPELLING:
|
|
248
|
+
assert sum(1 for line in statements if needle in line) == 1, tag
|
|
249
|
+
|
|
250
|
+
|
|
251
|
+
def test_the_divide_is_div_rn_and_never_slash(product):
|
|
252
|
+
"""Triton's fp32 ``/`` is ``div.full.f32``; the oracle's ``true_divide`` is correctly
|
|
253
|
+
rounded. The correctly rounded intrinsic is the spelling and ``/`` is a mutation."""
|
|
254
|
+
statements = product.increment_statements()
|
|
255
|
+
assert any("value = tl.math.div_rn(diff, d_im1)" in line for line in statements)
|
|
256
|
+
divisions = [line for line in statements
|
|
257
|
+
if " = " in line and " / " in line.split("#", 1)[0] and "//" not in line]
|
|
258
|
+
assert divisions == [], divisions
|
|
259
|
+
assert "* (1.0 / " not in "".join(statements)
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
def test_the_field_is_left_of_the_weight_and_the_axis_row_is_an_exact_zero(product):
|
|
263
|
+
statements = product.increment_statements()
|
|
264
|
+
assert "weighted_here = own1 * w_i" in statements
|
|
265
|
+
assert "weighted_below = halo * w_im1" in statements
|
|
266
|
+
assert "value = tl.where(inner, value, 0.0)" in statements
|
|
267
|
+
assert "inner = live & (i >= 1)" in statements
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
def test_the_halo_is_a_recompute_through_the_certified_body(product):
|
|
271
|
+
"""The one foreign value is ``_h_tap`` at ``i - 1`` under the ``inner`` guard, never a
|
|
272
|
+
load of the stored Hy and never a load of the scratch."""
|
|
273
|
+
statements = product.increment_statements()
|
|
274
|
+
joined = "\n".join(statements)
|
|
275
|
+
assert "halo = _h_tap(1, i - 1, j, k, inner," in joined
|
|
276
|
+
assert "tl.load(hi1 + idx - nyz" not in joined
|
|
277
|
+
assert "tl.load(ho1 + idx - nyz" not in joined
|
|
278
|
+
# ...and the constitutive half is the certified body, imported, not copied.
|
|
279
|
+
text = pathlib.Path(product.__file__).read_text(encoding="utf-8")
|
|
280
|
+
assert "from .fused_hd_pair import _h_cell, _h_tap" in text
|
|
281
|
+
assert "def _h_cell(" not in text
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def test_the_constitutive_lift_this_product_launches_still_holds(product):
|
|
285
|
+
from .triton_kernels import fused_hd_pair
|
|
286
|
+
|
|
287
|
+
assert fused_hd_pair.certified_constitutive_tail() == fused_hd_pair.lifted_constitutive_tail()
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
def test_launch_two_is_the_certified_curl_object_and_no_curl_text_is_copied(product):
|
|
291
|
+
text = pathlib.Path(product.__file__).read_text(encoding="utf-8")
|
|
292
|
+
assert "_cyl.cylindrical_curl_kernel()" in text
|
|
293
|
+
for needle in ("curl0 =", "curl1 =", "curl2 =", "def cyl_pml_curl_step"):
|
|
294
|
+
assert needle not in text, needle
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def test_the_curl_launch_is_the_shipped_plans_argument_list(product):
|
|
298
|
+
"""Launch 2's argument order is ``cyl_pml_curl_step``'s signature, read off the
|
|
299
|
+
certified module rather than trusted: targets, auxiliaries, the three stepped H,
|
|
300
|
+
the prefix, Hp for the axis add, the six coefficients, the scalars."""
|
|
301
|
+
from .triton_kernels import cylindrical_triton
|
|
302
|
+
|
|
303
|
+
tree = ast.parse(pathlib.Path(cylindrical_triton.__file__).read_text(encoding="utf-8"))
|
|
304
|
+
kernel = next(node for node in ast.walk(tree)
|
|
305
|
+
if isinstance(node, ast.FunctionDef) and node.name == "cyl_pml_curl_step")
|
|
306
|
+
names = [arg.arg for arg in kernel.args.args]
|
|
307
|
+
assert names[:11] == ["f0", "f1", "f2", "u0", "u1", "u2", "g0", "g1", "g2", "pfx", "hp"]
|
|
308
|
+
assert names[11:17] == ["kmx", "sinvx", "kmy", "sinvy", "kmz", "sinvz"]
|
|
309
|
+
assert names[17:23] == ["nx", "ny", "nz", "n_elem", "dtdx", "four_dtdx"]
|
|
310
|
+
launch = inspect.getsource(product.CylindricalRealFusedHdPairPlan._launch)
|
|
311
|
+
assert "*self._targets, *self._aux," in launch
|
|
312
|
+
assert "scratch[0], scratch[1], scratch[2]," in launch
|
|
313
|
+
assert "pointer(prefix), scratch[1]," in launch
|
|
314
|
+
assert "nx, ny, nz, self.n_elem, self.dtdx, self.four_dtdx," in launch
|
|
315
|
+
assert "BACKWARD=self.backward," in launch
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
def test_the_restated_block_size_is_the_certified_modules_own(product):
|
|
319
|
+
text = (PACKAGE_DIR / "kernels.py").read_text(encoding="utf-8")
|
|
320
|
+
tree = ast.parse(text)
|
|
321
|
+
certified = next(
|
|
322
|
+
node.value.value for node in tree.body
|
|
323
|
+
if isinstance(node, ast.Assign)
|
|
324
|
+
and getattr(node.targets[0], "id", None) == "DEFAULT_BLOCK")
|
|
325
|
+
assert product.DEFAULT_BLOCK == certified
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
def test_both_halves_take_the_integer_sub_lattice(product):
|
|
329
|
+
curl, constitutive = product._sub_lattice_suffixes()
|
|
330
|
+
assert curl == constitutive == ""
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
# ---------------------------------------------------------------------------
|
|
334
|
+
# The predicate
|
|
335
|
+
# ---------------------------------------------------------------------------
|
|
336
|
+
|
|
337
|
+
def test_an_undeclared_source_list_is_refused_by_name(product):
|
|
338
|
+
fields, pml = build()
|
|
339
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(fields, pml, None))
|
|
340
|
+
assert any("was not declared" in reason for reason in reasons), reasons
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
def test_a_standing_integrated_electric_withdraw_is_refused_by_name(product):
|
|
344
|
+
fields, pml = build()
|
|
345
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(
|
|
346
|
+
fields, pml, (_Electric(),)))
|
|
347
|
+
assert any("standing integrated" in reason for reason in reasons), reasons
|
|
348
|
+
assert any("HOISTS_THE_WITHDRAW = False" in reason for reason in reasons), reasons
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
def test_a_non_integrated_electric_source_and_a_magnetic_one_are_not_refused(product):
|
|
352
|
+
fields, pml = build()
|
|
353
|
+
for source in (_NonIntegratedElectric(), _Magnetic()):
|
|
354
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(
|
|
355
|
+
fields, pml, (source,)))
|
|
356
|
+
assert not any("withdraw" in reason for reason in reasons), reasons
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
def test_on_a_numpy_host_only_the_array_module_clause_refuses_a_healthy_row(product):
|
|
360
|
+
"""Everything but ``xp is cupy`` admits the fixture -- the same subtraction every
|
|
361
|
+
Triton laptop suite makes, so the other clauses can be asserted at all."""
|
|
362
|
+
fields, pml = build()
|
|
363
|
+
verdict = product.cylindrical_real_fused_hd_pair_coverage(fields, pml, ())
|
|
364
|
+
assert not verdict.covered
|
|
365
|
+
assert _reasons(verdict) == [], _reasons(verdict)
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
def test_complex_storage_is_refused_by_the_real_family(product):
|
|
369
|
+
fields, pml = build(force_complex_fields=True)
|
|
370
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(fields, pml, ()))
|
|
371
|
+
assert any("complex64" in reason for reason in reasons), reasons
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
def test_m_not_zero_is_refused_by_name(product):
|
|
375
|
+
fields, pml = build(m=1, force_complex_fields=True)
|
|
376
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(fields, pml, ()))
|
|
377
|
+
assert any("m = 0 ONLY" in reason for reason in reasons), reasons
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
def test_a_cartesian_grid_is_refused_by_name(product):
|
|
381
|
+
grid = Grid(resolution=10.0, cell_size=(1.2, 1.2, 0.0), dimensions=2,
|
|
382
|
+
boundaries={"x": "metallic", "y": "metallic", "z": "periodic"})
|
|
383
|
+
fields = Fields(grid=grid, force_complex_fields=False)
|
|
384
|
+
fields.enable_pml_storage()
|
|
385
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(
|
|
386
|
+
fields, PML(grid=grid, thickness=0.2), ()))
|
|
387
|
+
assert any("not cylindrical" in reason for reason in reasons), reasons
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
def test_a_missing_step_scratch_is_refused_by_name(product):
|
|
391
|
+
fields, pml = build()
|
|
392
|
+
reasons = _reasons(product.cylindrical_real_fused_hd_pair_coverage(
|
|
393
|
+
_View(fields, scratch=None), pml, ()))
|
|
394
|
+
assert any("StepScratch" in reason for reason in reasons), reasons
|
|
395
|
+
|
|
396
|
+
|
|
397
|
+
def test_an_inactive_absorber_is_named_by_the_constitutive_half_first(product):
|
|
398
|
+
fields, pml = build(thickness=0)
|
|
399
|
+
verdict = product.cylindrical_real_fused_hd_pair_coverage(fields, pml, ())
|
|
400
|
+
assert not verdict.covered
|
|
401
|
+
assert verdict.reasons[0].startswith("cylindrical constitutive half"), verdict.reasons
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def test_the_builder_returns_none_rather_than_raising_on_a_refused_run(product):
|
|
405
|
+
fields, pml = build(thickness=0)
|
|
406
|
+
assert product.plan_cylindrical_real_fused_hd_pair(fields, pml, ()) is None
|
|
407
|
+
|
|
408
|
+
|
|
409
|
+
# ---------------------------------------------------------------------------
|
|
410
|
+
# The composition
|
|
411
|
+
# ---------------------------------------------------------------------------
|
|
412
|
+
|
|
413
|
+
def test_the_composer_is_offered_this_product_and_refuses_it_by_the_flag(product):
|
|
414
|
+
"""ROUTED 2026-09-07. The row, the arm pair and the label are in the shipped
|
|
415
|
+
tables -- the composer's (``CERTIFIED_FUSED_PRODUCTS``, ``CERTIFIED_FUSED_PAIR_ARMS``,
|
|
416
|
+
``SUPPORT_MODULES``), the dispatcher's (``FUSED_ARM_CONSTITUENTS``,
|
|
417
|
+
``PENDING_DEVICE_GATE_ARMS``) and the board's join
|
|
418
|
+
(``dispatch_reachability.PRODUCT_ARM_LABELS``) -- and what keeps the product out of
|
|
419
|
+
every slot is its own ``INSTALLABLE = False``, which ``_declared_uninstallable``
|
|
420
|
+
reports by name on every row BEFORE the predicate is asked. Until the routing
|
|
421
|
+
round this test asserted the absence from every one of those tables; the
|
|
422
|
+
tables moved and so did the pin."""
|
|
423
|
+
from .triton_kernels import launch as launch_module
|
|
424
|
+
from . import fastpath, withdraw_hoist
|
|
425
|
+
|
|
426
|
+
row = launch_module.CERTIFIED_FUSED_PRODUCTS[FAMILY]
|
|
427
|
+
assert row == {"curl_slot": "update_H", "module": FAMILY,
|
|
428
|
+
"coverage": "cylindrical_real_fused_hd_pair_coverage",
|
|
429
|
+
"builder": "plan_cylindrical_real_fused_hd_pair",
|
|
430
|
+
"label": "fused pair H->D (cylindrical)"}
|
|
431
|
+
assert launch_module.CERTIFIED_FUSED_PAIR_ARMS[FAMILY] == product.ARMS == (
|
|
432
|
+
"cylindrical", "cylindrical PML")
|
|
433
|
+
assert FAMILY in launch_module.SUPPORT_MODULES
|
|
434
|
+
assert launch_module.CERTIFIED_FUSED_PAIR_SEAMS["update_H"] == ("step_D", withdraw_hoist.SEAM)
|
|
435
|
+
label = row["label"]
|
|
436
|
+
assert fastpath.arm_is_fused(label)
|
|
437
|
+
assert fastpath.FUSED_ARM_CONSTITUENTS[label] == product.ARMS
|
|
438
|
+
assert label in fastpath.PENDING_DEVICE_GATE_ARMS and label not in fastpath.ARM_CERTIFICATION
|
|
439
|
+
assert "INSTALLABLE = False" in fastpath.PENDING_DEVICE_GATE_ARMS[label]
|
|
440
|
+
assert label not in fastpath.RELEASED_FUSED_ARMS
|
|
441
|
+
parity_dir = str(pathlib.Path(__file__).resolve().parents[1] / "parity" / "meep_gpu")
|
|
442
|
+
if parity_dir not in sys.path:
|
|
443
|
+
sys.path.insert(0, parity_dir)
|
|
444
|
+
import dispatch_reachability as reach # noqa: PLC0415
|
|
445
|
+
|
|
446
|
+
assert reach.PRODUCT_ARM_LABELS[FAMILY] == label
|
|
447
|
+
assert FAMILY not in reach.CERTIFIED_BUT_NOT_INSTALLED
|
|
448
|
+
# The refusal the composer records, read through the seam the composer reads it.
|
|
449
|
+
declared = launch_module._declared_uninstallable({FAMILY: product}, FAMILY, row)
|
|
450
|
+
assert declared is not None and "INSTALLABLE = False" in declared
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
def test_the_composer_refuses_this_product_on_both_brakes(product):
|
|
454
|
+
from .triton_kernels import launch as launch_module
|
|
455
|
+
|
|
456
|
+
selected = {"step_B": "fused pair B (cylindrical)", "update_H": "fused pair B (cylindrical)",
|
|
457
|
+
"step_D": "fused pair D (cylindrical)", "update_E": "fused pair D (cylindrical)"}
|
|
458
|
+
refusal = launch_module._pair_may_absorb(selected, "update_H", "step_D", product.ARMS)
|
|
459
|
+
assert refusal is not None
|
|
460
|
+
assert "'fused pair B (cylindrical)'" in refusal and "'cylindrical'" in refusal
|
|
461
|
+
entry = {"curl_slot": "update_H", "module": FAMILY,
|
|
462
|
+
"coverage": "cylindrical_real_fused_hd_pair_coverage",
|
|
463
|
+
"builder": "plan_cylindrical_real_fused_hd_pair",
|
|
464
|
+
"label": "fused pair H->D (cylindrical)"}
|
|
465
|
+
declared = launch_module._declared_uninstallable({FAMILY: product}, FAMILY, entry)
|
|
466
|
+
assert declared is not None and "INSTALLABLE = False" in declared
|
|
467
|
+
assert product.INSTALLABLE_REASON in declared
|
|
468
|
+
|
|
469
|
+
|
|
470
|
+
# ---------------------------------------------------------------------------
|
|
471
|
+
# The plan
|
|
472
|
+
# ---------------------------------------------------------------------------
|
|
473
|
+
|
|
474
|
+
def _arrays(product, shape=(6, 1, 5)):
|
|
475
|
+
arrays = {name: numpy.zeros(shape, dtype=numpy.float32)
|
|
476
|
+
for name in product.ROTATED + product.IN_PLACE + product.CONSTITUTIVE_SOURCES}
|
|
477
|
+
for name in product.ROTATED:
|
|
478
|
+
arrays["scratch_" + name] = numpy.zeros(shape, dtype=numpy.float32)
|
|
479
|
+
flat = {f"{stem}_{axis}": numpy.zeros(n, dtype=numpy.float32)
|
|
480
|
+
for stem in ("kms", "sinv", "kps")
|
|
481
|
+
for axis, n in zip("xyz", shape)}
|
|
482
|
+
|
|
483
|
+
class _Holder:
|
|
484
|
+
pass
|
|
485
|
+
|
|
486
|
+
holder = _Holder()
|
|
487
|
+
for name in product.ROTATED:
|
|
488
|
+
setattr(holder, name, arrays[name])
|
|
489
|
+
return arrays, flat, holder
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
def test_the_plan_rotates_exactly_the_six_magnetic_volumes(product):
|
|
493
|
+
from .triton_kernels.offdiag_scratch_weld import ScratchWeldPairPlan
|
|
494
|
+
|
|
495
|
+
assert issubclass(product.CylindricalRealFusedHdPairPlan, ScratchWeldPairPlan)
|
|
496
|
+
assert product.CylindricalRealFusedHdPairPlan.replaces == product.REPLACES
|
|
497
|
+
assert product.CylindricalRealFusedHdPairPlan.launches_per_run == 3
|
|
498
|
+
assert product.CylindricalRealFusedHdPairPlan.kernel_launches_per_run == 2
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
def test_the_plan_binds_the_pools_own_slots(product):
|
|
502
|
+
arrays, flat, holder = _arrays(product)
|
|
503
|
+
scratch = StepScratch(numpy)
|
|
504
|
+
plan = product.plan_cylindrical_real_fused_hd_pair_from_arrays(
|
|
505
|
+
arrays, flat, 0.35, holder, numpy, scratch)
|
|
506
|
+
increment = plan._increment()
|
|
507
|
+
assert increment is scratch.take("cyl_increment", (6, 1, 5), numpy.dtype("float32"))
|
|
508
|
+
assert plan._prefix_out() is scratch.take("cyl_prefix", (6, 1, 5), numpy.dtype("float32"))
|
|
509
|
+
assert plan._weights.shape == (6, 1, 1) and plan._divisor.shape == (5, 1, 1)
|
|
510
|
+
assert plan.four_dtdx == float(numpy.float32(4.0 * 0.35))
|
|
511
|
+
|
|
512
|
+
|
|
513
|
+
def test_a_none_pool_and_a_phi_extent_above_one_are_refused(product):
|
|
514
|
+
arrays, flat, holder = _arrays(product)
|
|
515
|
+
with pytest.raises(ValueError):
|
|
516
|
+
product.plan_cylindrical_real_fused_hd_pair_from_arrays(arrays, flat, 0.35, holder,
|
|
517
|
+
numpy, None)
|
|
518
|
+
arrays2, flat2, holder2 = _arrays(product, shape=(6, 2, 5))
|
|
519
|
+
with pytest.raises(ValueError):
|
|
520
|
+
product.plan_cylindrical_real_fused_hd_pair_from_arrays(arrays2, flat2, 0.35, holder2,
|
|
521
|
+
numpy, StepScratch(numpy))
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
def test_an_aliased_scratch_pair_is_refused_rather_than_launched(product):
|
|
525
|
+
arrays, flat, holder = _arrays(product)
|
|
526
|
+
arrays["scratch_Hy"] = arrays["Hy"]
|
|
527
|
+
with pytest.raises((ValueError, RuntimeError)):
|
|
528
|
+
plan = product.plan_cylindrical_real_fused_hd_pair_from_arrays(
|
|
529
|
+
arrays, flat, 0.35, holder, numpy, StepScratch(numpy))
|
|
530
|
+
plan._resolve()
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
def test_an_input_that_aliases_an_output_is_refused(product):
|
|
534
|
+
arrays, flat, holder = _arrays(product)
|
|
535
|
+
arrays["Bx"] = arrays["Dx"]
|
|
536
|
+
with pytest.raises(ValueError):
|
|
537
|
+
product.plan_cylindrical_real_fused_hd_pair_from_arrays(arrays, flat, 0.35, holder,
|
|
538
|
+
numpy, StepScratch(numpy))
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
def test_the_module_is_importable_without_triton(product):
|
|
542
|
+
if product.triton is not None: # pragma: no cover - a device host
|
|
543
|
+
pytest.skip("Triton is importable here; the absence path is the laptop's")
|
|
544
|
+
with pytest.raises(ImportError):
|
|
545
|
+
product.cyl_real_update_H_increment_kernel()
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
# ---------------------------------------------------------------------------
|
|
549
|
+
# The gate's own host legs
|
|
550
|
+
# ---------------------------------------------------------------------------
|
|
551
|
+
|
|
552
|
+
def test_the_gates_host_legs_pass_here(gate):
|
|
553
|
+
for leg in (gate.leg_driver_order, gate.leg_transcription, gate.leg_purity_ledger,
|
|
554
|
+
gate.leg_ghost_observability):
|
|
555
|
+
result = leg()
|
|
556
|
+
assert result["passed"], result["findings"]
|
|
557
|
+
|
|
558
|
+
|
|
559
|
+
def test_the_purity_ledger_is_not_vacuous(gate):
|
|
560
|
+
result = gate.leg_purity_ledger()
|
|
561
|
+
for case, ledger in result["fixtures"].items():
|
|
562
|
+
assert ledger["halo_source_words_update_H_moved"] > 0, case
|
|
563
|
+
assert ledger["f_w_Hy_words_moved"] > 0, case
|
|
564
|
+
|
|
565
|
+
|
|
566
|
+
def test_every_mutation_needle_resolves_exactly_once(gate, product):
|
|
567
|
+
source = pathlib.Path(product.__file__).read_text(encoding="utf-8")
|
|
568
|
+
for tag, spec in gate.MUTATIONS.items():
|
|
569
|
+
assert spec["why"], tag
|
|
570
|
+
assert spec["case"] in dict(gate.CASES), tag
|
|
571
|
+
if spec["target"] != "kernel":
|
|
572
|
+
continue
|
|
573
|
+
assert source.count(spec["old"]) == 1, tag
|
|
574
|
+
assert source.count(gate.BYTE_NEUTRAL["old"]) == 1
|
|
575
|
+
nulls = [tag for tag, spec in gate.MUTATIONS.items()
|
|
576
|
+
if spec.get("expected_override") == "NULL"]
|
|
577
|
+
assert nulls, "a mutation set with no predicted null has not been thought about"
|
|
578
|
+
for tag in nulls:
|
|
579
|
+
assert ("PREDICTED NULL" in gate.MUTATIONS[tag]["why"]
|
|
580
|
+
or "MEASURED NULL" in gate.MUTATIONS[tag]["why"]), tag
|
|
581
|
+
# THE ARMED SPELLINGS the design names are all here, and the stored-halo plant.
|
|
582
|
+
for tag in ("m_divide_spelled_with_slash", "m_reciprocal_multiply", "m_fp_fusion_on",
|
|
583
|
+
"m_subtract_reversed", "m_ir0_zero_ladder", "m_halo_reads_the_stored_Hy",
|
|
584
|
+
"m_rotation_skipped", "m_curl_reads_the_pre_launch_H", "m_scan_skipped"):
|
|
585
|
+
assert tag in gate.MUTATIONS, tag
|
|
586
|
+
assert gate.MUTATIONS[tag]["expected"] == "CAUGHT"
|
|
587
|
+
assert "expected_override" not in gate.MUTATIONS[tag], tag
|
|
588
|
+
# The scratch-halo read is a MEASURED null on a one-program fixture and says so.
|
|
589
|
+
assert gate.MUTATIONS["m_halo_reads_the_neighbours_scratch"]["expected_override"] == "NULL"
|
|
590
|
+
assert dict(gate.CASES)[gate.MUTATION_CASE]["shape"][0] * dict(gate.CASES)[gate.MUTATION_CASE]["shape"][1] <= 256
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
def test_the_increment_variants_carry_the_kernels_own_spelling(gate, product):
|
|
594
|
+
"""The ``primary`` variant IS the launch-1 statements (multiply field-left, subtract,
|
|
595
|
+
``div_rn``), so the increment leg measures the product's arithmetic, not a look-alike."""
|
|
596
|
+
primary = gate.INCREMENT_VARIANTS["primary"]
|
|
597
|
+
assert "tl.math.div_rn(diff, d_im1)" in primary["divide"]
|
|
598
|
+
assert "f_i * w_i" in primary["multiply"] and "f_im1 * w_im1" in primary["multiply"]
|
|
599
|
+
assert primary["expected"] == "IDENTICAL" and primary["also_fusion_on"]
|
|
600
|
+
assert gate.INCREMENT_VARIANTS["slash_div_full"]["divide"] == "value = diff / d_im1"
|
|
601
|
+
for name in ("slash_div_full", "reciprocal_multiply", "distributed_divide"):
|
|
602
|
+
assert gate.INCREMENT_VARIANTS[name]["expected"] == "DIFFERS", name
|
|
603
|
+
assert gate.INCREMENT_VARIANTS["swapped_multiply_operands"]["expected"] == "IDENTICAL"
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def test_the_curl_redirect_names_every_magnetic_argument_of_launch_two(gate):
|
|
607
|
+
"""``cyl_pml_curl_step(f0..u2, g0, g1, g2, pfx, hp, ...)``: g0..g2 at 6..8 and Hp at 10."""
|
|
608
|
+
assert gate.SPEC.curl_prelaunch_positions() == {6: 0, 7: 1, 8: 2, 10: 1}
|
|
609
|
+
|
|
610
|
+
|
|
611
|
+
def test_the_gate_binds_the_driver_the_composer_and_the_kit(gate):
|
|
612
|
+
for name in ("meep_gpu/driver.py", "meep_gpu/triton_kernels/launch.py",
|
|
613
|
+
"meep_gpu/triton_kernels/cylindrical_triton.py",
|
|
614
|
+
"meep_gpu/triton_kernels/fused_hd_pair.py",
|
|
615
|
+
"meep_gpu/triton_kernels/cylindrical_real_fused_hd_pair.py",
|
|
616
|
+
"meep_gpu/stepping.py", "meep_gpu/withdraw_hoist.py",
|
|
617
|
+
"parity/meep_gpu/triton_cylindrical_hd_gate_kit.py"):
|
|
618
|
+
assert name in gate.SOURCES
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
def test_the_gates_cell_is_the_boards_cell(gate, product):
|
|
622
|
+
assert gate.CELL_ARMS == product.ARMS
|
|
623
|
+
assert gate.SEAM_RECORD == "h_to_d_seam_2026-09-04"
|
|
624
|
+
assert gate.CENSUS == "predicate_coverage_triton_2026-09-04_cylm0"
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
def test_the_lift_basis_is_the_three_real_rows_the_seam_record_prices(gate):
|
|
628
|
+
results = pathlib.Path(gate.HERE) / "results"
|
|
629
|
+
if not (results / gate.CENSUS).is_dir() or not (results / gate.SEAM_RECORD).is_dir():
|
|
630
|
+
pytest.skip("the standing census or the seam record is not in this checkout")
|
|
631
|
+
rows, facts = gate.lift_basis(results)
|
|
632
|
+
assert facts["rows_in_cell"] == len(rows) == 3
|
|
633
|
+
assert sorted(row["label"] for row in rows) == [
|
|
634
|
+
"tests:TestAdjointSolver.test_adjoint_solver_cyl_n2f_fields_0_0",
|
|
635
|
+
"tests:TestAdjointSolver.test_adjoint_solver_cyl_n2f_fields_1_0",
|
|
636
|
+
"tests:TestPMLCylindrical.test_pml_cyl_0_0_0"]
|
|
637
|
+
assert facts["rows_with_a_standing_withdraw"] == []
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
def test_the_kit_keeps_the_one_bar_and_the_scan_on_the_array_path(gate):
|
|
641
|
+
"""The seam claim is the template's conjunction, every arrangement must equal the
|
|
642
|
+
array path over the full budget, and the product leaves ``cumsum`` to the array
|
|
643
|
+
module -- pinned in the kit's source so it cannot quietly widen."""
|
|
644
|
+
kit = sys.modules["triton_cylindrical_hd_gate_kit"]
|
|
645
|
+
source = inspect.getsource(kit.run_product)
|
|
646
|
+
for clause in ("the_weld_at_its_seam_equals_the_two_certified_singles",
|
|
647
|
+
"the_weld_equals_the_unfused_composition",
|
|
648
|
+
"the_weld_equals_the_composition_installed_today"):
|
|
649
|
+
assert clause in source, clause
|
|
650
|
+
assert 'and result["bit_identical"]' in source
|
|
651
|
+
assert "stop_when_banded=False" in source
|
|
652
|
+
# Both floors on the seeded fixture; on a lifted row (floors measured on the array
|
|
653
|
+
# path's FINAL state, because the seed is the engine's zeros) the prefix must be
|
|
654
|
+
# live and the axis row's liveness is recorded -- a fact about the row.
|
|
655
|
+
assert 'floors_hold = floors["prefix_is_live"] and (floors["axis_row_is_live"]' in source
|
|
656
|
+
assert 'or floors_at == "end")' in source
|
|
657
|
+
assert "and floors_hold" in source
|
|
658
|
+
assert 'floors_at="end"' in inspect.getsource(kit.evaluate_row)
|
|
659
|
+
scan = inspect.getsource(kit.leg_scan_order)
|
|
660
|
+
assert "serial_device_vs_cupy_cumsum_differing" in scan
|
|
661
|
+
assert "serial_device_vs_numpy_cumsum_differing" in scan
|
|
662
|
+
launch = inspect.getsource(gate.family.CylindricalRealFusedHdPairPlan._launch)
|
|
663
|
+
assert "self.xp.cumsum(increment, axis=0, out=self._prefix_out())" in launch
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
def test_the_kits_curl_redirect_is_not_inert(gate):
|
|
667
|
+
"""An earlier kit set an attribute nothing read; the redirect now installs an
|
|
668
|
+
argument-swapping kernel in the plan's own ``_curl_kernel`` seam and asserts it
|
|
669
|
+
launched exactly once."""
|
|
670
|
+
kit = sys.modules["triton_cylindrical_hd_gate_kit"]
|
|
671
|
+
source = inspect.getsource(kit.CurlReadsPreLaunchH.run)
|
|
672
|
+
assert "ArgSwappingKernel" in source
|
|
673
|
+
assert "plan._curl_kernel = swapper" in source
|
|
674
|
+
assert "swapper.calls != 1" in source
|
|
675
|
+
assert "_launch_curl_sources" not in inspect.getsource(kit)
|