diff --git a/examples/kernels b/examples/kernels index 1f7c9fdff97f215376a03633459e237e95cc118f..ce21e19d86dcb763e5ce66366a80e1cbe5107c94 100644 --- a/examples/kernels +++ b/examples/kernels @@ -1,775 +1,775 @@ digraph AST { node [color=lightblue2 style=filled] size="6,6" - n139894378445120 [label=Block] - n139894377979128 [label=Module] - n139894378445120 -> n139894377979128 - n139894377979184 [label=Module] - n139894378445120 -> n139894377979184 - n139894377979128 [label=Module] - n139894377979072 [label=Block] - n139894377979128 -> n139894377979072 - n139894377979072 [label=Block] - n139894377976328 [label=ParticleFor] - n139894377979072 -> n139894377976328 - n139894377976328 [label=ParticleFor] - n139894377215144 [label=Block] - n139894377976328 -> n139894377215144 - n139894380476008 [label=nlocal] - n139894377976328 -> n139894380476008 - n139894377215144 [label=Block] - n139894377215312 [label=For] - n139894377215144 -> n139894377215312 - n139894377215592 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377215592 -> n139894377214976 - n139894377975880 [label=neighborlist_capacity] - n139894377215592 -> n139894377975880 - n139894377214976 [label="Iter(14)"] - n139894377975880 [label=neighborlist_capacity] - n139894377215816 [label=PropertyAccess] - n139894378445344 [label=position] - n139894377215816 -> n139894378445344 - n139894377214976 [label="Iter(14)"] - n139894377215816 -> n139894377214976 - n139894377216992 [label="*"] - n139894377215816 -> n139894377216992 - n139894377251672 [label="+"] - n139894377215816 -> n139894377251672 - n139894377253464 [label="+"] - n139894377215816 -> n139894377253464 - n139894378445344 [label=position] - n139894377216992 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377216992 -> n139894377214976 - n139894377217048 [label=3] - n139894377216992 -> n139894377217048 - n139894377217048 [label=3] - n139894377251672 [label="+"] - n139894377251504 [label="*"] - n139894377251672 -> n139894377251504 - n139894377251728 [label=1] - n139894377251672 -> n139894377251728 - n139894377251504 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377251504 -> n139894377214976 - n139894377251560 [label=3] - n139894377251504 -> n139894377251560 - n139894377251560 [label=3] - n139894377251728 [label=1] - n139894377253464 [label="+"] - n139894377253296 [label="*"] - n139894377253464 -> n139894377253296 - n139894377253520 [label=2] - n139894377253464 -> n139894377253520 - n139894377253296 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377253296 -> n139894377214976 - n139894377253352 [label=3] - n139894377253296 -> n139894377253352 - n139894377253352 [label=3] - n139894377253520 [label=2] - n139894377216208 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377216208 -> n139894377214976 - n139894377216264 [label=3] - n139894377216208 -> n139894377216264 - n139894377216264 [label=3] - n139894377217888 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377217888 -> n139894377214976 - n139894377217944 [label=3] - n139894377217888 -> n139894377217944 - n139894377217944 [label=3] - n139894377250888 [label="+"] - n139894377217888 [label="*"] - n139894377250888 -> n139894377217888 - n139894377250944 [label=1] - n139894377250888 -> n139894377250944 - n139894377250944 [label=1] - n139894377252512 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894377252512 -> n139894377214976 - n139894377252568 [label=3] - n139894377252512 -> n139894377252568 - n139894377252568 [label=3] - n139894377252680 [label="+"] - n139894377252512 [label="*"] - n139894377252680 -> n139894377252512 - n139894377252736 [label=2] - n139894377252680 -> n139894377252736 - n139894377252736 [label=2] - n139894378124344 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894378124344 -> n139894377214976 - n139894378124400 [label=3] - n139894378124344 -> n139894378124400 - n139894378124400 [label=3] - n139894378124736 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894378124736 -> n139894377214976 - n139894378124792 [label=3] - n139894378124736 -> n139894378124792 - n139894378124792 [label=3] - n139894378125240 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894378125240 -> n139894377214976 - n139894378125296 [label=3] - n139894378125240 -> n139894378125296 - n139894378125296 [label=3] - n139894378125408 [label="+"] - n139894378125240 [label="*"] - n139894378125408 -> n139894378125240 - n139894378125464 [label=1] - n139894378125408 -> n139894378125464 - n139894378125464 [label=1] - n139894378125632 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894378125632 -> n139894377214976 - n139894378125688 [label=3] - n139894378125632 -> n139894378125688 - n139894378125688 [label=3] - n139894378125800 [label="+"] - n139894378125632 [label="*"] - n139894378125800 -> n139894378125632 - n139894378125856 [label=1] - n139894378125800 -> n139894378125856 - n139894378125856 [label=1] - n139894378126136 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894378126136 -> n139894377214976 - n139894378126192 [label=3] - n139894378126136 -> n139894378126192 - n139894378126192 [label=3] - n139894378126304 [label="+"] - n139894378126136 [label="*"] - n139894378126304 -> n139894378126136 - n139894378126360 [label=2] - n139894378126304 -> n139894378126360 - n139894378126360 [label=2] - n139894378126528 [label="*"] - n139894377214976 [label="Iter(14)"] - n139894378126528 -> n139894377214976 - n139894378126584 [label=3] - n139894378126528 -> n139894378126584 - n139894378126584 [label=3] - n139894378126696 [label="+"] - n139894378126528 [label="*"] - n139894378126696 -> n139894378126528 - n139894378126752 [label=2] - n139894378126696 -> n139894378126752 - n139894378126752 [label=2] - n139894377215312 [label=For] - n139894377215368 [label="Iter(15)"] - n139894377215312 -> n139894377215368 - n139894377215480 [label=Block] - n139894377215312 -> n139894377215480 - n139894377215424 [label=0] - n139894377215312 -> n139894377215424 - n139894377215256 [label=ArrayAccess] - n139894377215312 -> n139894377215256 - n139894377215368 [label="Iter(15)"] - n139894377215480 [label=Block] - n139894377254416 [label=Filter] - n139894377215480 -> n139894377254416 - n139894377215704 [label="+"] - n139894377215592 [label="*"] - n139894377215704 -> n139894377215592 - n139894377215368 [label="Iter(15)"] - n139894377215704 -> n139894377215368 - n139894377215928 [label=PropertyAccess] - n139894378445344 [label=position] - n139894377215928 -> n139894378445344 - n139894377215536 [label=ArrayAccess] - n139894377215928 -> n139894377215536 - n139894377217328 [label="*"] - n139894377215928 -> n139894377217328 - n139894377252008 [label="+"] - n139894377215928 -> n139894377252008 - n139894377253800 [label="+"] - n139894377215928 -> n139894377253800 - n139894377215536 [label=ArrayAccess] - n139894377975936 [label=neighborlists] - n139894377215536 -> n139894377975936 - n139894377215704 [label="+"] - n139894377215536 -> n139894377215704 - n139894377975936 [label=neighborlists] - n139894377217328 [label="*"] - n139894377215536 [label=ArrayAccess] - n139894377217328 -> n139894377215536 - n139894377217384 [label=3] - n139894377217328 -> n139894377217384 - n139894377217384 [label=3] - n139894377252008 [label="+"] - n139894377251840 [label="*"] - n139894377252008 -> n139894377251840 - n139894377252064 [label=1] - n139894377252008 -> n139894377252064 - n139894377251840 [label="*"] - n139894377215536 [label=ArrayAccess] - n139894377251840 -> n139894377215536 - n139894377251896 [label=3] - n139894377251840 -> n139894377251896 - n139894377251896 [label=3] - n139894377252064 [label=1] - n139894377253800 [label="+"] - n139894377253632 [label="*"] - n139894377253800 -> n139894377253632 - n139894377253856 [label=2] - n139894377253800 -> n139894377253856 - n139894377253632 [label="*"] - n139894377215536 [label=ArrayAccess] - n139894377253632 -> n139894377215536 - n139894377253688 [label=3] - n139894377253632 -> n139894377253688 - n139894377253688 [label=3] - n139894377253856 [label=2] - n139894377216040 [label="-"] - n139894377215816 [label=PropertyAccess] - n139894377216040 -> n139894377215816 - n139894377215928 [label=PropertyAccess] - n139894377216040 -> n139894377215928 - n139894377216544 [label="*"] - n139894377215536 [label=ArrayAccess] - n139894377216544 -> n139894377215536 - n139894377216600 [label=3] - n139894377216544 -> n139894377216600 - n139894377216600 [label=3] - n139894377217720 [label="*"] - n139894377216880 [label=VectorAccess] - n139894377217720 -> n139894377216880 - n139894377217664 [label=VectorAccess] - n139894377217720 -> n139894377217664 - n139894377216880 [label=VectorAccess] - n139894377216040 [label="-"] - n139894377216880 -> n139894377216040 - n139894377217664 [label=VectorAccess] - n139894377216040 [label="-"] - n139894377217664 -> n139894377216040 - n139894377251056 [label="*"] - n139894377215536 [label=ArrayAccess] - n139894377251056 -> n139894377215536 - n139894377251112 [label=3] - n139894377251056 -> n139894377251112 - n139894377251112 [label=3] - n139894377251224 [label="+"] - n139894377251056 [label="*"] - n139894377251224 -> n139894377251056 - n139894377251280 [label=1] - n139894377251224 -> n139894377251280 - n139894377251280 [label=1] - n139894377252232 [label="*"] - n139894377251392 [label=VectorAccess] - n139894377252232 -> n139894377251392 - n139894377252176 [label=VectorAccess] - n139894377252232 -> n139894377252176 - n139894377251392 [label=VectorAccess] - n139894377216040 [label="-"] - n139894377251392 -> n139894377216040 - n139894377252176 [label=VectorAccess] - n139894377216040 [label="-"] - n139894377252176 -> n139894377216040 - n139894377252344 [label="+"] - n139894377217720 [label="*"] - n139894377252344 -> n139894377217720 - n139894377252232 [label="*"] - n139894377252344 -> n139894377252232 - n139894377252848 [label="*"] - n139894377215536 [label=ArrayAccess] - n139894377252848 -> n139894377215536 - n139894377252904 [label=3] - n139894377252848 -> n139894377252904 - n139894377252904 [label=3] - n139894377253016 [label="+"] - n139894377252848 [label="*"] - n139894377253016 -> n139894377252848 - n139894377253072 [label=2] - n139894377253016 -> n139894377253072 - n139894377253072 [label=2] - n139894377254024 [label="*"] - n139894377253184 [label=VectorAccess] - n139894377254024 -> n139894377253184 - n139894377253968 [label=VectorAccess] - n139894377254024 -> n139894377253968 - n139894377253184 [label=VectorAccess] - n139894377216040 [label="-"] - n139894377253184 -> n139894377216040 - n139894377253968 [label=VectorAccess] - n139894377216040 [label="-"] - n139894377253968 -> n139894377216040 - n139894377254136 [label="+"] - n139894377252344 [label="+"] - n139894377254136 -> n139894377252344 - n139894377254024 [label="*"] - n139894377254136 -> n139894377254024 - n139894377254248 [label="<"] - n139894377254136 [label="+"] - n139894377254248 -> n139894377254136 - n139894377254304 [label=2.5] - n139894377254248 -> n139894377254304 - n139894377254304 [label=2.5] - n139894377254416 [label=Filter] - n139894377254248 [label="<"] - n139894377254416 -> n139894377254248 - n139894377979016 [label=Block] - n139894377254416 -> n139894377979016 - n139894377979016 [label=Block] - n139894378124232 [label=Assign] - n139894377979016 -> n139894378124232 - n139894377979352 [label="/"] - n139894381174120 [label=1.0] - n139894377979352 -> n139894381174120 - n139894377254136 [label="+"] - n139894377979352 -> n139894377254136 - n139894381174120 [label=1.0] - n139894377979464 [label="*"] - n139894377979352 [label="/"] - n139894377979464 -> n139894377979352 - n139894377979352 [label="/"] - n139894377979464 -> n139894377979352 - n139894377979576 [label="*"] - n139894377979464 [label="*"] - n139894377979576 -> n139894377979464 - n139894377979352 [label="/"] - n139894377979576 -> n139894377979352 - n139894377979296 [label=PropertyAccess] - n139894378445456 [label=force] - n139894377979296 -> n139894378445456 - n139894377214976 [label="Iter(14)"] - n139894377979296 -> n139894377214976 - n139894378124736 [label="*"] - n139894377979296 -> n139894378124736 - n139894378125800 [label="+"] - n139894377979296 -> n139894378125800 - n139894378126696 [label="+"] - n139894377979296 -> n139894378126696 - n139894378445456 [label=force] - n139894377976552 [label="*"] - n139894377216040 [label="-"] - n139894377976552 -> n139894377216040 - n139894378123336 [label=48.0] - n139894377976552 -> n139894378123336 - n139894378123336 [label=48.0] - n139894378123448 [label="*"] - n139894377216040 [label="-"] - n139894378123448 -> n139894377216040 - n139894377694768 [label="*"] - n139894378123448 -> n139894377694768 - n139894377694768 [label="*"] - n139894378123336 [label=48.0] - n139894377694768 -> n139894378123336 - n139894377979576 [label="*"] - n139894377694768 -> n139894377979576 - n139894378123560 [label="-"] - n139894377979576 [label="*"] - n139894378123560 -> n139894377979576 - n139894378123616 [label=0.5] - n139894378123560 -> n139894378123616 - n139894378123616 [label=0.5] - n139894378123728 [label="*"] - n139894377216040 [label="-"] - n139894378123728 -> n139894377216040 - n139894377694264 [label="*"] - n139894378123728 -> n139894377694264 - n139894377694264 [label="*"] - n139894377694768 [label="*"] - n139894377694264 -> n139894377694768 - n139894378123560 [label="-"] - n139894377694264 -> n139894378123560 - n139894378123840 [label="*"] - n139894377216040 [label="-"] - n139894378123840 -> n139894377216040 - n139894377977672 [label="*"] - n139894378123840 -> n139894377977672 - n139894377977672 [label="*"] - n139894377694264 [label="*"] - n139894377977672 -> n139894377694264 - n139894377979352 [label="/"] - n139894377977672 -> n139894377979352 - n139894378123952 [label="*"] - n139894377216040 [label="-"] - n139894378123952 -> n139894377216040 - n139894377977672 [label="*"] - n139894378123952 -> n139894377977672 - n139894378124120 [label="+"] - n139894377979296 [label=PropertyAccess] - n139894378124120 -> n139894377979296 - n139894378123952 [label="*"] - n139894378124120 -> n139894378123952 - n139894378124232 [label=Assign] - n139894378125128 [label=VectorAccess] - n139894378124232 -> n139894378125128 - n139894378124680 [label=VectorAccess] - n139894378124232 -> n139894378124680 - n139894378126024 [label=VectorAccess] - n139894378124232 -> n139894378126024 - n139894378125576 [label=VectorAccess] - n139894378124232 -> n139894378125576 - n139894378126920 [label=VectorAccess] - n139894378124232 -> n139894378126920 - n139894378126472 [label=VectorAccess] - n139894378124232 -> n139894378126472 - n139894378125128 [label=VectorAccess] - n139894377979296 [label=PropertyAccess] - n139894378125128 -> n139894377979296 - n139894378124680 [label=VectorAccess] - n139894378124120 [label="+"] - n139894378124680 -> n139894378124120 - n139894378126024 [label=VectorAccess] - n139894377979296 [label=PropertyAccess] - n139894378126024 -> n139894377979296 - n139894378125576 [label=VectorAccess] - n139894378124120 [label="+"] - n139894378125576 -> n139894378124120 - n139894378126920 [label=VectorAccess] - n139894377979296 [label=PropertyAccess] - n139894378126920 -> n139894377979296 - n139894378126472 [label=VectorAccess] - n139894378124120 [label="+"] - n139894378126472 -> n139894378124120 - n139894377215424 [label=0] - n139894377215256 [label=ArrayAccess] - n139894377975992 [label=numneighs] - n139894377215256 -> n139894377975992 - n139894377214976 [label="Iter(14)"] - n139894377215256 -> n139894377214976 - n139894377975992 [label=numneighs] - n139894380476008 [label=nlocal] - n139894377979184 [label=Module] - n139894377976440 [label=Block] - n139894377979184 -> n139894377976440 - n139894377976440 [label=Block] - n139894377978736 [label=ParticleFor] - n139894377976440 -> n139894377978736 - n139894377978736 [label=ParticleFor] - n139894377976664 [label=Block] - n139894377978736 -> n139894377976664 - n139894380476008 [label=nlocal] - n139894377978736 -> n139894380476008 - n139894377976664 [label=Block] - n139894378172880 [label=Assign] - n139894377976664 -> n139894378172880 - n139894378193528 [label=Assign] - n139894377976664 -> n139894378193528 - n139894378127032 [label=PropertyAccess] - n139894378445400 [label=velocity] - n139894378127032 -> n139894378445400 - n139894377977728 [label="Iter(0)"] - n139894378127032 -> n139894377977728 - n139894378173384 [label="*"] - n139894378127032 -> n139894378173384 - n139894378175120 [label="+"] - n139894378127032 -> n139894378175120 - n139894378176296 [label="+"] - n139894378127032 -> n139894378176296 - n139894378445400 [label=velocity] - n139894377977728 [label="Iter(0)"] - n139894378173384 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378173384 -> n139894377977728 - n139894378173776 [label=3] - n139894378173384 -> n139894378173776 - n139894378173776 [label=3] - n139894378175120 [label="+"] - n139894378174616 [label="*"] - n139894378175120 -> n139894378174616 - n139894379473608 [label=1] - n139894378175120 -> n139894379473608 - n139894378174616 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378174616 -> n139894377977728 - n139894378175008 [label=3] - n139894378174616 -> n139894378175008 - n139894378175008 [label=3] - n139894379473608 [label=1] - n139894378176296 [label="+"] - n139894378175792 [label="*"] - n139894378176296 -> n139894378175792 - n139894378176352 [label=2] - n139894378176296 -> n139894378176352 - n139894378175792 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378175792 -> n139894377977728 - n139894378176184 [label=3] - n139894378175792 -> n139894378176184 - n139894378176184 [label=3] - n139894378176352 [label=2] - n139894378127144 [label=PropertyAccess] - n139894378445456 [label=force] - n139894378127144 -> n139894378445456 - n139894377977728 [label="Iter(0)"] - n139894378127144 -> n139894377977728 - n139894378173440 [label="*"] - n139894378127144 -> n139894378173440 - n139894378174840 [label="+"] - n139894378127144 -> n139894378174840 - n139894378176016 [label="+"] - n139894378127144 -> n139894378176016 - n139894378173440 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378173440 -> n139894377977728 - n139894378173496 [label=3] - n139894378173440 -> n139894378173496 - n139894378173496 [label=3] - n139894378174840 [label="+"] - n139894378174672 [label="*"] - n139894378174840 -> n139894378174672 - n139894378174896 [label=1] - n139894378174840 -> n139894378174896 - n139894378174672 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378174672 -> n139894377977728 - n139894378174728 [label=3] - n139894378174672 -> n139894378174728 - n139894378174728 [label=3] - n139894378174896 [label=1] - n139894378176016 [label="+"] - n139894378175848 [label="*"] - n139894378176016 -> n139894378175848 - n139894378176072 [label=2] - n139894378176016 -> n139894378176072 - n139894378175848 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378175848 -> n139894377977728 - n139894378175904 [label=3] - n139894378175848 -> n139894378175904 - n139894378175904 [label=3] - n139894378176072 [label=2] - n139894378127256 [label="*"] - n139894378127312 [label=0.005] - n139894378127256 -> n139894378127312 - n139894378127144 [label=PropertyAccess] - n139894378127256 -> n139894378127144 - n139894378127312 [label=0.005] - n139894378172544 [label=PropertyAccess] - n139894378445288 [label=mass] - n139894378172544 -> n139894378445288 - n139894377977728 [label="Iter(0)"] - n139894378172544 -> n139894377977728 - n139894378445288 [label=mass] - n139894378172656 [label="/"] - n139894378127256 [label="*"] - n139894378172656 -> n139894378127256 - n139894378172544 [label=PropertyAccess] - n139894378172656 -> n139894378172544 - n139894378172768 [label="+"] - n139894378127032 [label=PropertyAccess] - n139894378172768 -> n139894378127032 - n139894378172656 [label="/"] - n139894378172768 -> n139894378172656 - n139894378172992 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378172992 -> n139894377977728 - n139894378173048 [label=3] - n139894378172992 -> n139894378173048 - n139894378173048 [label=3] - n139894378174224 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378174224 -> n139894377977728 - n139894378174280 [label=3] - n139894378174224 -> n139894378174280 - n139894378174280 [label=3] - n139894378174392 [label="+"] - n139894378174224 [label="*"] - n139894378174392 -> n139894378174224 - n139894378174448 [label=1] - n139894378174392 -> n139894378174448 - n139894378174448 [label=1] - n139894378175400 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378175400 -> n139894377977728 - n139894378175456 [label=3] - n139894378175400 -> n139894378175456 - n139894378175456 [label=3] - n139894378175568 [label="+"] - n139894378175400 [label="*"] - n139894378175568 -> n139894378175400 - n139894378175624 [label=2] - n139894378175568 -> n139894378175624 - n139894378175624 [label=2] - n139894378172880 [label=Assign] - n139894378174112 [label=VectorAccess] - n139894378172880 -> n139894378174112 - n139894378173328 [label=VectorAccess] - n139894378172880 -> n139894378173328 - n139894378175288 [label=VectorAccess] - n139894378172880 -> n139894378175288 - n139894378174560 [label=VectorAccess] - n139894378172880 -> n139894378174560 - n139894378192968 [label=VectorAccess] - n139894378172880 -> n139894378192968 - n139894378175736 [label=VectorAccess] - n139894378172880 -> n139894378175736 - n139894378174112 [label=VectorAccess] - n139894378127032 [label=PropertyAccess] - n139894378174112 -> n139894378127032 - n139894378173328 [label=VectorAccess] - n139894378172768 [label="+"] - n139894378173328 -> n139894378172768 - n139894378175288 [label=VectorAccess] - n139894378127032 [label=PropertyAccess] - n139894378175288 -> n139894378127032 - n139894378174560 [label=VectorAccess] - n139894378172768 [label="+"] - n139894378174560 -> n139894378172768 - n139894378192968 [label=VectorAccess] - n139894378127032 [label=PropertyAccess] - n139894378192968 -> n139894378127032 - n139894378175736 [label=VectorAccess] - n139894378172768 [label="+"] - n139894378175736 -> n139894378172768 - n139894378193024 [label=PropertyAccess] - n139894378445344 [label=position] - n139894378193024 -> n139894378445344 - n139894377977728 [label="Iter(0)"] - n139894378193024 -> n139894377977728 - n139894378194368 [label="*"] - n139894378193024 -> n139894378194368 - n139894378195768 [label="+"] - n139894378193024 -> n139894378195768 - n139894377693256 [label="+"] - n139894378193024 -> n139894377693256 - n139894378194368 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378194368 -> n139894377977728 - n139894378194424 [label=3] - n139894378194368 -> n139894378194424 - n139894378194424 [label=3] - n139894378195768 [label="+"] - n139894378195600 [label="*"] - n139894378195768 -> n139894378195600 - n139894378195824 [label=1] - n139894378195768 -> n139894378195824 - n139894378195600 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378195600 -> n139894377977728 - n139894378195656 [label=3] - n139894378195600 -> n139894378195656 - n139894378195656 [label=3] - n139894378195824 [label=1] - n139894377693256 [label="+"] - n139894378196832 [label="*"] - n139894377693256 -> n139894378196832 - n139894377693312 [label=2] - n139894377693256 -> n139894377693312 - n139894378196832 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378196832 -> n139894377977728 - n139894378196888 [label=3] - n139894378196832 -> n139894378196888 - n139894378196888 [label=3] - n139894377693312 [label=2] - n139894378193136 [label=PropertyAccess] - n139894378445400 [label=velocity] - n139894378193136 -> n139894378445400 - n139894377977728 [label="Iter(0)"] - n139894378193136 -> n139894377977728 - n139894378194032 [label="*"] - n139894378193136 -> n139894378194032 - n139894378195432 [label="+"] - n139894378193136 -> n139894378195432 - n139894378196664 [label="+"] - n139894378193136 -> n139894378196664 - n139894378194032 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378194032 -> n139894377977728 - n139894378194088 [label=3] - n139894378194032 -> n139894378194088 - n139894378194088 [label=3] - n139894378195432 [label="+"] - n139894378195264 [label="*"] - n139894378195432 -> n139894378195264 - n139894378195488 [label=1] - n139894378195432 -> n139894378195488 - n139894378195264 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378195264 -> n139894377977728 - n139894378195320 [label=3] - n139894378195264 -> n139894378195320 - n139894378195320 [label=3] - n139894378195488 [label=1] - n139894378196664 [label="+"] - n139894378196496 [label="*"] - n139894378196664 -> n139894378196496 - n139894378196720 [label=2] - n139894378196664 -> n139894378196720 - n139894378196496 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378196496 -> n139894377977728 - n139894378196552 [label=3] - n139894378196496 -> n139894378196552 - n139894378196552 [label=3] - n139894378196720 [label=2] - n139894378193248 [label="*"] - n139894378193304 [label=0.005] - n139894378193248 -> n139894378193304 - n139894378193136 [label=PropertyAccess] - n139894378193248 -> n139894378193136 - n139894378193304 [label=0.005] - n139894378193416 [label="+"] - n139894378193024 [label=PropertyAccess] - n139894378193416 -> n139894378193024 - n139894378193248 [label="*"] - n139894378193416 -> n139894378193248 - n139894378193640 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378193640 -> n139894377977728 - n139894378193696 [label=3] - n139894378193640 -> n139894378193696 - n139894378193696 [label=3] - n139894378194872 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378194872 -> n139894377977728 - n139894378194928 [label=3] - n139894378194872 -> n139894378194928 - n139894378194928 [label=3] - n139894378195040 [label="+"] - n139894378194872 [label="*"] - n139894378195040 -> n139894378194872 - n139894378195096 [label=1] - n139894378195040 -> n139894378195096 - n139894378195096 [label=1] - n139894378196104 [label="*"] - n139894377977728 [label="Iter(0)"] - n139894378196104 -> n139894377977728 - n139894378196160 [label=3] - n139894378196104 -> n139894378196160 - n139894378196160 [label=3] - n139894378196272 [label="+"] - n139894378196104 [label="*"] - n139894378196272 -> n139894378196104 - n139894378196328 [label=2] - n139894378196272 -> n139894378196328 - n139894378196328 [label=2] - n139894378193528 [label=Assign] - n139894378194760 [label=VectorAccess] - n139894378193528 -> n139894378194760 - n139894378193976 [label=VectorAccess] - n139894378193528 -> n139894378193976 - n139894378195992 [label=VectorAccess] - n139894378193528 -> n139894378195992 - n139894378195208 [label=VectorAccess] - n139894378193528 -> n139894378195208 - n139894377693480 [label=VectorAccess] - n139894378193528 -> n139894377693480 - n139894378196440 [label=VectorAccess] - n139894378193528 -> n139894378196440 - n139894378194760 [label=VectorAccess] - n139894378193024 [label=PropertyAccess] - n139894378194760 -> n139894378193024 - n139894378193976 [label=VectorAccess] - n139894378193416 [label="+"] - n139894378193976 -> n139894378193416 - n139894378195992 [label=VectorAccess] - n139894378193024 [label=PropertyAccess] - n139894378195992 -> n139894378193024 - n139894378195208 [label=VectorAccess] - n139894378193416 [label="+"] - n139894378195208 -> n139894378193416 - n139894377693480 [label=VectorAccess] - n139894378193024 [label=PropertyAccess] - n139894377693480 -> n139894378193024 - n139894378196440 [label=VectorAccess] - n139894378193416 [label="+"] - n139894378196440 -> n139894378193416 + n139694044691368 [label=Block] + n139694044233568 [label=Module] + n139694044691368 -> n139694044233568 + n139694044233624 [label=Module] + n139694044691368 -> n139694044233624 + n139694044233568 [label=Module] + n139694044233512 [label=Block] + n139694044233568 -> n139694044233512 + n139694044233512 [label=Block] + n139694044230768 [label=ParticleFor] + n139694044233512 -> n139694044230768 + n139694044230768 [label=ParticleFor] + n139694044080280 [label=Block] + n139694044230768 -> n139694044080280 + n139694046706880 [label=nlocal] + n139694044230768 -> n139694046706880 + n139694044080280 [label=Block] + n139694044080448 [label=For] + n139694044080280 -> n139694044080448 + n139694044080728 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044080728 -> n139694044080112 + n139694044230320 [label=neighborlist_capacity] + n139694044080728 -> n139694044230320 + n139694044080112 [label="Iter(14)"] + n139694044230320 [label=neighborlist_capacity] + n139694044080952 [label=PropertyAccess] + n139694044691592 [label=position] + n139694044080952 -> n139694044691592 + n139694044080112 [label="Iter(14)"] + n139694044080952 -> n139694044080112 + n139694044082128 [label="*"] + n139694044080952 -> n139694044082128 + n139694043498312 [label="+"] + n139694044080952 -> n139694043498312 + n139694043500104 [label="+"] + n139694044080952 -> n139694043500104 + n139694044691592 [label=position] + n139694044082128 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044082128 -> n139694044080112 + n139694043496520 [label=3] + n139694044082128 -> n139694043496520 + n139694043496520 [label=3] + n139694043498312 [label="+"] + n139694043498144 [label="*"] + n139694043498312 -> n139694043498144 + n139694043498368 [label=1] + n139694043498312 -> n139694043498368 + n139694043498144 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694043498144 -> n139694044080112 + n139694043498200 [label=3] + n139694043498144 -> n139694043498200 + n139694043498200 [label=3] + n139694043498368 [label=1] + n139694043500104 [label="+"] + n139694043499936 [label="*"] + n139694043500104 -> n139694043499936 + n139694043500160 [label=2] + n139694043500104 -> n139694043500160 + n139694043499936 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694043499936 -> n139694044080112 + n139694043499992 [label=3] + n139694043499936 -> n139694043499992 + n139694043499992 [label=3] + n139694043500160 [label=2] + n139694044081344 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044081344 -> n139694044080112 + n139694044081400 [label=3] + n139694044081344 -> n139694044081400 + n139694044081400 [label=3] + n139694043497360 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694043497360 -> n139694044080112 + n139694043497416 [label=3] + n139694043497360 -> n139694043497416 + n139694043497416 [label=3] + n139694043497528 [label="+"] + n139694043497360 [label="*"] + n139694043497528 -> n139694043497360 + n139694043497584 [label=1] + n139694043497528 -> n139694043497584 + n139694043497584 [label=1] + n139694043499152 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694043499152 -> n139694044080112 + n139694043499208 [label=3] + n139694043499152 -> n139694043499208 + n139694043499208 [label=3] + n139694043499320 [label="+"] + n139694043499152 [label="*"] + n139694043499320 -> n139694043499152 + n139694043499376 [label=2] + n139694043499320 -> n139694043499376 + n139694043499376 [label=2] + n139694044305112 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044305112 -> n139694044080112 + n139694044305168 [label=3] + n139694044305112 -> n139694044305168 + n139694044305168 [label=3] + n139694044305504 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044305504 -> n139694044080112 + n139694044305560 [label=3] + n139694044305504 -> n139694044305560 + n139694044305560 [label=3] + n139694044306008 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044306008 -> n139694044080112 + n139694044306064 [label=3] + n139694044306008 -> n139694044306064 + n139694044306064 [label=3] + n139694044306176 [label="+"] + n139694044306008 [label="*"] + n139694044306176 -> n139694044306008 + n139694044306232 [label=1] + n139694044306176 -> n139694044306232 + n139694044306232 [label=1] + n139694044306400 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044306400 -> n139694044080112 + n139694044306456 [label=3] + n139694044306400 -> n139694044306456 + n139694044306456 [label=3] + n139694044306568 [label="+"] + n139694044306400 [label="*"] + n139694044306568 -> n139694044306400 + n139694044306624 [label=1] + n139694044306568 -> n139694044306624 + n139694044306624 [label=1] + n139694044306904 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044306904 -> n139694044080112 + n139694044306960 [label=3] + n139694044306904 -> n139694044306960 + n139694044306960 [label=3] + n139694044307072 [label="+"] + n139694044306904 [label="*"] + n139694044307072 -> n139694044306904 + n139694044307128 [label=2] + n139694044307072 -> n139694044307128 + n139694044307128 [label=2] + n139694044307296 [label="*"] + n139694044080112 [label="Iter(14)"] + n139694044307296 -> n139694044080112 + n139694044307352 [label=3] + n139694044307296 -> n139694044307352 + n139694044307352 [label=3] + n139694044397640 [label="+"] + n139694044307296 [label="*"] + n139694044397640 -> n139694044307296 + n139694044397696 [label=2] + n139694044397640 -> n139694044397696 + n139694044397696 [label=2] + n139694044080448 [label=For] + n139694044080504 [label="Iter(15)"] + n139694044080448 -> n139694044080504 + n139694044080616 [label=Block] + n139694044080448 -> n139694044080616 + n139694044080560 [label=0] + n139694044080448 -> n139694044080560 + n139694044080392 [label=ArrayAccess] + n139694044080448 -> n139694044080392 + n139694044080504 [label="Iter(15)"] + n139694044080616 [label=Block] + n139694043529792 [label=Filter] + n139694044080616 -> n139694043529792 + n139694044080840 [label="+"] + n139694044080728 [label="*"] + n139694044080840 -> n139694044080728 + n139694044080504 [label="Iter(15)"] + n139694044080840 -> n139694044080504 + n139694044081064 [label=PropertyAccess] + n139694044691592 [label=position] + n139694044081064 -> n139694044691592 + n139694044080672 [label=ArrayAccess] + n139694044081064 -> n139694044080672 + n139694043496800 [label="*"] + n139694044081064 -> n139694043496800 + n139694043498648 [label="+"] + n139694044081064 -> n139694043498648 + n139694043500440 [label="+"] + n139694044081064 -> n139694043500440 + n139694044080672 [label=ArrayAccess] + n139694044230376 [label=neighborlists] + n139694044080672 -> n139694044230376 + n139694044080840 [label="+"] + n139694044080672 -> n139694044080840 + n139694044230376 [label=neighborlists] + n139694043496800 [label="*"] + n139694044080672 [label=ArrayAccess] + n139694043496800 -> n139694044080672 + n139694043496856 [label=3] + n139694043496800 -> n139694043496856 + n139694043496856 [label=3] + n139694043498648 [label="+"] + n139694043498480 [label="*"] + n139694043498648 -> n139694043498480 + n139694043498704 [label=1] + n139694043498648 -> n139694043498704 + n139694043498480 [label="*"] + n139694044080672 [label=ArrayAccess] + n139694043498480 -> n139694044080672 + n139694043498536 [label=3] + n139694043498480 -> n139694043498536 + n139694043498536 [label=3] + n139694043498704 [label=1] + n139694043500440 [label="+"] + n139694043500272 [label="*"] + n139694043500440 -> n139694043500272 + n139694043500496 [label=2] + n139694043500440 -> n139694043500496 + n139694043500272 [label="*"] + n139694044080672 [label=ArrayAccess] + n139694043500272 -> n139694044080672 + n139694043500328 [label=3] + n139694043500272 -> n139694043500328 + n139694043500328 [label=3] + n139694043500496 [label=2] + n139694044081176 [label="-"] + n139694044080952 [label=PropertyAccess] + n139694044081176 -> n139694044080952 + n139694044081064 [label=PropertyAccess] + n139694044081176 -> n139694044081064 + n139694044081680 [label="*"] + n139694044080672 [label=ArrayAccess] + n139694044081680 -> n139694044080672 + n139694044081736 [label=3] + n139694044081680 -> n139694044081736 + n139694044081736 [label=3] + n139694043497192 [label="*"] + n139694044082016 [label=VectorAccess] + n139694043497192 -> n139694044082016 + n139694043497136 [label=VectorAccess] + n139694043497192 -> n139694043497136 + n139694044082016 [label=VectorAccess] + n139694044081176 [label="-"] + n139694044082016 -> n139694044081176 + n139694043497136 [label=VectorAccess] + n139694044081176 [label="-"] + n139694043497136 -> n139694044081176 + n139694043497696 [label="*"] + n139694044080672 [label=ArrayAccess] + n139694043497696 -> n139694044080672 + n139694043497752 [label=3] + n139694043497696 -> n139694043497752 + n139694043497752 [label=3] + n139694043497864 [label="+"] + n139694043497696 [label="*"] + n139694043497864 -> n139694043497696 + n139694043497920 [label=1] + n139694043497864 -> n139694043497920 + n139694043497920 [label=1] + n139694043498872 [label="*"] + n139694043498032 [label=VectorAccess] + n139694043498872 -> n139694043498032 + n139694043498816 [label=VectorAccess] + n139694043498872 -> n139694043498816 + n139694043498032 [label=VectorAccess] + n139694044081176 [label="-"] + n139694043498032 -> n139694044081176 + n139694043498816 [label=VectorAccess] + n139694044081176 [label="-"] + n139694043498816 -> n139694044081176 + n139694043498984 [label="+"] + n139694043497192 [label="*"] + n139694043498984 -> n139694043497192 + n139694043498872 [label="*"] + n139694043498984 -> n139694043498872 + n139694043499488 [label="*"] + n139694044080672 [label=ArrayAccess] + n139694043499488 -> n139694044080672 + n139694043499544 [label=3] + n139694043499488 -> n139694043499544 + n139694043499544 [label=3] + n139694043499656 [label="+"] + n139694043499488 [label="*"] + n139694043499656 -> n139694043499488 + n139694043499712 [label=2] + n139694043499656 -> n139694043499712 + n139694043499712 [label=2] + n139694043529400 [label="*"] + n139694043499824 [label=VectorAccess] + n139694043529400 -> n139694043499824 + n139694043529344 [label=VectorAccess] + n139694043529400 -> n139694043529344 + n139694043499824 [label=VectorAccess] + n139694044081176 [label="-"] + n139694043499824 -> n139694044081176 + n139694043529344 [label=VectorAccess] + n139694044081176 [label="-"] + n139694043529344 -> n139694044081176 + n139694043529512 [label="+"] + n139694043498984 [label="+"] + n139694043529512 -> n139694043498984 + n139694043529400 [label="*"] + n139694043529512 -> n139694043529400 + n139694043529624 [label="<"] + n139694043529512 [label="+"] + n139694043529624 -> n139694043529512 + n139694043529680 [label=2.5] + n139694043529624 -> n139694043529680 + n139694043529680 [label=2.5] + n139694043529792 [label=Filter] + n139694043529624 [label="<"] + n139694043529792 -> n139694043529624 + n139694044233456 [label=Block] + n139694043529792 -> n139694044233456 + n139694044233456 [label=Block] + n139694044305000 [label=Assign] + n139694044233456 -> n139694044305000 + n139694044303432 [label="/"] + n139694044303488 [label=1.0] + n139694044303432 -> n139694044303488 + n139694043529512 [label="+"] + n139694044303432 -> n139694043529512 + n139694044303488 [label=1.0] + n139694044303600 [label="*"] + n139694044303432 [label="/"] + n139694044303600 -> n139694044303432 + n139694044303432 [label="/"] + n139694044303600 -> n139694044303432 + n139694044303712 [label="*"] + n139694044303600 [label="*"] + n139694044303712 -> n139694044303600 + n139694044303432 [label="/"] + n139694044303712 -> n139694044303432 + n139694044230992 [label=PropertyAccess] + n139694044691704 [label=force] + n139694044230992 -> n139694044691704 + n139694044080112 [label="Iter(14)"] + n139694044230992 -> n139694044080112 + n139694044305504 [label="*"] + n139694044230992 -> n139694044305504 + n139694044306568 [label="+"] + n139694044230992 -> n139694044306568 + n139694044397640 [label="+"] + n139694044230992 -> n139694044397640 + n139694044691704 [label=force] + n139694044304048 [label="*"] + n139694044081176 [label="-"] + n139694044304048 -> n139694044081176 + n139694044304104 [label=48.0] + n139694044304048 -> n139694044304104 + n139694044304104 [label=48.0] + n139694044304216 [label="*"] + n139694044081176 [label="-"] + n139694044304216 -> n139694044081176 + n139694043940960 [label="*"] + n139694044304216 -> n139694043940960 + n139694043940960 [label="*"] + n139694044304104 [label=48.0] + n139694043940960 -> n139694044304104 + n139694044303712 [label="*"] + n139694043940960 -> n139694044303712 + n139694044304328 [label="-"] + n139694044303712 [label="*"] + n139694044304328 -> n139694044303712 + n139694044304384 [label=0.5] + n139694044304328 -> n139694044304384 + n139694044304384 [label=0.5] + n139694044304496 [label="*"] + n139694044081176 [label="-"] + n139694044304496 -> n139694044081176 + n139694043940456 [label="*"] + n139694044304496 -> n139694043940456 + n139694043940456 [label="*"] + n139694043940960 [label="*"] + n139694043940456 -> n139694043940960 + n139694044304328 [label="-"] + n139694043940456 -> n139694044304328 + n139694044304608 [label="*"] + n139694044081176 [label="-"] + n139694044304608 -> n139694044081176 + n139694044232112 [label="*"] + n139694044304608 -> n139694044232112 + n139694044232112 [label="*"] + n139694043940456 [label="*"] + n139694044232112 -> n139694043940456 + n139694044303432 [label="/"] + n139694044232112 -> n139694044303432 + n139694044304720 [label="*"] + n139694044081176 [label="-"] + n139694044304720 -> n139694044081176 + n139694044232112 [label="*"] + n139694044304720 -> n139694044232112 + n139694044304888 [label="+"] + n139694044230992 [label=PropertyAccess] + n139694044304888 -> n139694044230992 + n139694044304720 [label="*"] + n139694044304888 -> n139694044304720 + n139694044305000 [label=Assign] + n139694044305896 [label=VectorAccess] + n139694044305000 -> n139694044305896 + n139694044305448 [label=VectorAccess] + n139694044305000 -> n139694044305448 + n139694044306792 [label=VectorAccess] + n139694044305000 -> n139694044306792 + n139694044306344 [label=VectorAccess] + n139694044305000 -> n139694044306344 + n139694044397864 [label=VectorAccess] + n139694044305000 -> n139694044397864 + n139694044307240 [label=VectorAccess] + n139694044305000 -> n139694044307240 + n139694044305896 [label=VectorAccess] + n139694044230992 [label=PropertyAccess] + n139694044305896 -> n139694044230992 + n139694044305448 [label=VectorAccess] + n139694044304888 [label="+"] + n139694044305448 -> n139694044304888 + n139694044306792 [label=VectorAccess] + n139694044230992 [label=PropertyAccess] + n139694044306792 -> n139694044230992 + n139694044306344 [label=VectorAccess] + n139694044304888 [label="+"] + n139694044306344 -> n139694044304888 + n139694044397864 [label=VectorAccess] + n139694044230992 [label=PropertyAccess] + n139694044397864 -> n139694044230992 + n139694044307240 [label=VectorAccess] + n139694044304888 [label="+"] + n139694044307240 -> n139694044304888 + n139694044080560 [label=0] + n139694044080392 [label=ArrayAccess] + n139694044230432 [label=numneighs] + n139694044080392 -> n139694044230432 + n139694044080112 [label="Iter(14)"] + n139694044080392 -> n139694044080112 + n139694044230432 [label=numneighs] + n139694046706880 [label=nlocal] + n139694044233624 [label=Module] + n139694044230880 [label=Block] + n139694044233624 -> n139694044230880 + n139694044230880 [label=Block] + n139694044233176 [label=ParticleFor] + n139694044230880 -> n139694044233176 + n139694044233176 [label=ParticleFor] + n139694044231104 [label=Block] + n139694044233176 -> n139694044231104 + n139694046706880 [label=nlocal] + n139694044233176 -> n139694046706880 + n139694044231104 [label=Block] + n139694044398704 [label=Assign] + n139694044231104 -> n139694044398704 + n139694043915544 [label=Assign] + n139694044231104 -> n139694043915544 + n139694044397976 [label=PropertyAccess] + n139694044691648 [label=velocity] + n139694044397976 -> n139694044691648 + n139694044232168 [label="Iter(0)"] + n139694044397976 -> n139694044232168 + n139694044399208 [label="*"] + n139694044397976 -> n139694044399208 + n139694044400888 [label="+"] + n139694044397976 -> n139694044400888 + n139694043914760 [label="+"] + n139694044397976 -> n139694043914760 + n139694044691648 [label=velocity] + n139694044232168 [label="Iter(0)"] + n139694044399208 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044399208 -> n139694044232168 + n139694044399600 [label=3] + n139694044399208 -> n139694044399600 + n139694044399600 [label=3] + n139694044400888 [label="+"] + n139694044400440 [label="*"] + n139694044400888 -> n139694044400440 + n139694044400944 [label=1] + n139694044400888 -> n139694044400944 + n139694044400440 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044400440 -> n139694044232168 + n139694044400776 [label=3] + n139694044400440 -> n139694044400776 + n139694044400776 [label=3] + n139694044400944 [label=1] + n139694043914760 [label="+"] + n139694044401616 [label="*"] + n139694043914760 -> n139694044401616 + n139694043914816 [label=2] + n139694043914760 -> n139694043914816 + n139694044401616 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044401616 -> n139694044232168 + n139694043914648 [label=3] + n139694044401616 -> n139694043914648 + n139694043914648 [label=3] + n139694043914816 [label=2] + n139694044398088 [label=PropertyAccess] + n139694044691704 [label=force] + n139694044398088 -> n139694044691704 + n139694044232168 [label="Iter(0)"] + n139694044398088 -> n139694044232168 + n139694044399264 [label="*"] + n139694044398088 -> n139694044399264 + n139694044400664 [label="+"] + n139694044398088 -> n139694044400664 + n139694043914480 [label="+"] + n139694044398088 -> n139694043914480 + n139694044399264 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044399264 -> n139694044232168 + n139694044399320 [label=3] + n139694044399264 -> n139694044399320 + n139694044399320 [label=3] + n139694044400664 [label="+"] + n139694044400496 [label="*"] + n139694044400664 -> n139694044400496 + n139694044400720 [label=1] + n139694044400664 -> n139694044400720 + n139694044400496 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044400496 -> n139694044232168 + n139694044400552 [label=3] + n139694044400496 -> n139694044400552 + n139694044400552 [label=3] + n139694044400720 [label=1] + n139694043914480 [label="+"] + n139694043914312 [label="*"] + n139694043914480 -> n139694043914312 + n139694043914536 [label=2] + n139694043914480 -> n139694043914536 + n139694043914312 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043914312 -> n139694044232168 + n139694043914368 [label=3] + n139694043914312 -> n139694043914368 + n139694043914368 [label=3] + n139694043914536 [label=2] + n139694044398200 [label="*"] + n139694044398256 [label=0.005] + n139694044398200 -> n139694044398256 + n139694044398088 [label=PropertyAccess] + n139694044398200 -> n139694044398088 + n139694044398256 [label=0.005] + n139694044398368 [label=PropertyAccess] + n139694044691536 [label=mass] + n139694044398368 -> n139694044691536 + n139694044232168 [label="Iter(0)"] + n139694044398368 -> n139694044232168 + n139694044691536 [label=mass] + n139694044398480 [label="/"] + n139694044398200 [label="*"] + n139694044398480 -> n139694044398200 + n139694044398368 [label=PropertyAccess] + n139694044398480 -> n139694044398368 + n139694044398592 [label="+"] + n139694044397976 [label=PropertyAccess] + n139694044398592 -> n139694044397976 + n139694044398480 [label="/"] + n139694044398592 -> n139694044398480 + n139694044398816 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044398816 -> n139694044232168 + n139694044398872 [label=3] + n139694044398816 -> n139694044398872 + n139694044398872 [label=3] + n139694044400048 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044400048 -> n139694044232168 + n139694044400104 [label=3] + n139694044400048 -> n139694044400104 + n139694044400104 [label=3] + n139694044400216 [label="+"] + n139694044400048 [label="*"] + n139694044400216 -> n139694044400048 + n139694044400272 [label=1] + n139694044400216 -> n139694044400272 + n139694044400272 [label=1] + n139694044401224 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694044401224 -> n139694044232168 + n139694044401280 [label=3] + n139694044401224 -> n139694044401280 + n139694044401280 [label=3] + n139694044401392 [label="+"] + n139694044401224 [label="*"] + n139694044401392 -> n139694044401224 + n139694044401448 [label=2] + n139694044401392 -> n139694044401448 + n139694044401448 [label=2] + n139694044398704 [label=Assign] + n139694044399936 [label=VectorAccess] + n139694044398704 -> n139694044399936 + n139694044399152 [label=VectorAccess] + n139694044398704 -> n139694044399152 + n139694044401112 [label=VectorAccess] + n139694044398704 -> n139694044401112 + n139694044400384 [label=VectorAccess] + n139694044398704 -> n139694044400384 + n139694043914984 [label=VectorAccess] + n139694044398704 -> n139694043914984 + n139694044401560 [label=VectorAccess] + n139694044398704 -> n139694044401560 + n139694044399936 [label=VectorAccess] + n139694044397976 [label=PropertyAccess] + n139694044399936 -> n139694044397976 + n139694044399152 [label=VectorAccess] + n139694044398592 [label="+"] + n139694044399152 -> n139694044398592 + n139694044401112 [label=VectorAccess] + n139694044397976 [label=PropertyAccess] + n139694044401112 -> n139694044397976 + n139694044400384 [label=VectorAccess] + n139694044398592 [label="+"] + n139694044400384 -> n139694044398592 + n139694043914984 [label=VectorAccess] + n139694044397976 [label=PropertyAccess] + n139694043914984 -> n139694044397976 + n139694044401560 [label=VectorAccess] + n139694044398592 [label="+"] + n139694044401560 -> n139694044398592 + n139694043915040 [label=PropertyAccess] + n139694044691592 [label=position] + n139694043915040 -> n139694044691592 + n139694044232168 [label="Iter(0)"] + n139694043915040 -> n139694044232168 + n139694043916328 [label="*"] + n139694043915040 -> n139694043916328 + n139694043917728 [label="+"] + n139694043915040 -> n139694043917728 + n139694043939504 [label="+"] + n139694043915040 -> n139694043939504 + n139694043916328 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043916328 -> n139694044232168 + n139694043916384 [label=3] + n139694043916328 -> n139694043916384 + n139694043916384 [label=3] + n139694043917728 [label="+"] + n139694043917560 [label="*"] + n139694043917728 -> n139694043917560 + n139694043917784 [label=1] + n139694043917728 -> n139694043917784 + n139694043917560 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043917560 -> n139694044232168 + n139694043917616 [label=3] + n139694043917560 -> n139694043917616 + n139694043917616 [label=3] + n139694043917784 [label=1] + n139694043939504 [label="+"] + n139694043939336 [label="*"] + n139694043939504 -> n139694043939336 + n139694043939560 [label=2] + n139694043939504 -> n139694043939560 + n139694043939336 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043939336 -> n139694044232168 + n139694043939392 [label=3] + n139694043939336 -> n139694043939392 + n139694043939392 [label=3] + n139694043939560 [label=2] + n139694043915152 [label=PropertyAccess] + n139694044691648 [label=velocity] + n139694043915152 -> n139694044691648 + n139694044232168 [label="Iter(0)"] + n139694043915152 -> n139694044232168 + n139694043915992 [label="*"] + n139694043915152 -> n139694043915992 + n139694043917392 [label="+"] + n139694043915152 -> n139694043917392 + n139694043939168 [label="+"] + n139694043915152 -> n139694043939168 + n139694043915992 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043915992 -> n139694044232168 + n139694043916048 [label=3] + n139694043915992 -> n139694043916048 + n139694043916048 [label=3] + n139694043917392 [label="+"] + n139694043917224 [label="*"] + n139694043917392 -> n139694043917224 + n139694043917448 [label=1] + n139694043917392 -> n139694043917448 + n139694043917224 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043917224 -> n139694044232168 + n139694043917280 [label=3] + n139694043917224 -> n139694043917280 + n139694043917280 [label=3] + n139694043917448 [label=1] + n139694043939168 [label="+"] + n139694043939000 [label="*"] + n139694043939168 -> n139694043939000 + n139694043939224 [label=2] + n139694043939168 -> n139694043939224 + n139694043939000 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043939000 -> n139694044232168 + n139694043939056 [label=3] + n139694043939000 -> n139694043939056 + n139694043939056 [label=3] + n139694043939224 [label=2] + n139694043915264 [label="*"] + n139694043915320 [label=0.005] + n139694043915264 -> n139694043915320 + n139694043915152 [label=PropertyAccess] + n139694043915264 -> n139694043915152 + n139694043915320 [label=0.005] + n139694043915432 [label="+"] + n139694043915040 [label=PropertyAccess] + n139694043915432 -> n139694043915040 + n139694043915264 [label="*"] + n139694043915432 -> n139694043915264 + n139694043915600 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043915600 -> n139694044232168 + n139694043915656 [label=3] + n139694043915600 -> n139694043915656 + n139694043915656 [label=3] + n139694043916832 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043916832 -> n139694044232168 + n139694043916888 [label=3] + n139694043916832 -> n139694043916888 + n139694043916888 [label=3] + n139694043917000 [label="+"] + n139694043916832 [label="*"] + n139694043917000 -> n139694043916832 + n139694043917056 [label=1] + n139694043917000 -> n139694043917056 + n139694043917056 [label=1] + n139694043918064 [label="*"] + n139694044232168 [label="Iter(0)"] + n139694043918064 -> n139694044232168 + n139694043918120 [label=3] + n139694043918064 -> n139694043918120 + n139694043918120 [label=3] + n139694043918232 [label="+"] + n139694043918064 [label="*"] + n139694043918232 -> n139694043918064 + n139694043918288 [label=2] + n139694043918232 -> n139694043918288 + n139694043918288 [label=2] + n139694043915544 [label=Assign] + n139694043916720 [label=VectorAccess] + n139694043915544 -> n139694043916720 + n139694043915936 [label=VectorAccess] + n139694043915544 -> n139694043915936 + n139694043917952 [label=VectorAccess] + n139694043915544 -> n139694043917952 + n139694043917168 [label=VectorAccess] + n139694043915544 -> n139694043917168 + n139694043939728 [label=VectorAccess] + n139694043915544 -> n139694043939728 + n139694043938944 [label=VectorAccess] + n139694043915544 -> n139694043938944 + n139694043916720 [label=VectorAccess] + n139694043915040 [label=PropertyAccess] + n139694043916720 -> n139694043915040 + n139694043915936 [label=VectorAccess] + n139694043915432 [label="+"] + n139694043915936 -> n139694043915432 + n139694043917952 [label=VectorAccess] + n139694043915040 [label=PropertyAccess] + n139694043917952 -> n139694043915040 + n139694043917168 [label=VectorAccess] + n139694043915432 [label="+"] + n139694043917168 -> n139694043915432 + n139694043939728 [label=VectorAccess] + n139694043915040 [label=PropertyAccess] + n139694043939728 -> n139694043915040 + n139694043938944 [label=VectorAccess] + n139694043915432 [label="+"] + n139694043938944 -> n139694043915432 } diff --git a/examples/kernels.pdf b/examples/kernels.pdf index c83c9db416d54831ecca26e6031d90f04ebe9433..cb83e854e7ecd3d5affde9f66adccfeb3d4d8930 100644 Binary files a/examples/kernels.pdf and b/examples/kernels.pdf differ diff --git a/examples/lj_ns.cpp b/examples/lj_ns.cpp index b588b2b4a2f59d5087857ed57e16bc7f9e245fcf..0a798b10587cd1d476e9fd2931abc525c667cb4f 100644 --- a/examples/lj_ns.cpp +++ b/examples/lj_ns.cpp @@ -12,633 +12,633 @@ using namespace pairs; void module_0(int neighborlist_capacity, int nlocal, int *neighborlists, int *numneighs, double *position, double *force) { fprintf(stdout, "module_0 --- enter\n"); fflush(stdout); - for(int i14 = 0; i14 < nlocal; i14++) { - const int e369 = i14 * neighborlist_capacity; - const int e376 = i14 * 3; - const double p23_0 = position[e376]; - const int e385 = i14 * 3; - const int e386 = e385 + 1; - const double p23_1 = position[e386]; - const int e395 = i14 * 3; - const int e396 = e395 + 2; - const double p23_2 = position[e396]; - const int e14 = i14 * 3; - const int e18 = i14 * 3; - const int e19 = e18 + 1; - const int e22 = i14 * 3; - const int e23 = e22 + 2; - const int a56 = numneighs[i14]; - for(int i15 = 0; i15 < a56; i15++) { - const int e370 = e369 + i15; - const int a57 = neighborlists[e370]; - const int e378 = a57 * 3; - const double p24_0 = position[e378]; - const int e387 = a57 * 3; - const int e388 = e387 + 1; - const double p24_1 = position[e388]; - const int e397 = a57 * 3; - const int e398 = e397 + 2; - const double p24_2 = position[e398]; - const double e371_0 = p23_0 - p24_0; - const double e371_1 = p23_1 - p24_1; - const double e371_2 = p23_2 - p24_2; - const double e380 = e371_0 * e371_0; - const double e389 = e371_1 * e371_1; - const double e390 = e380 + e389; - const double e399 = e371_2 * e371_2; - const double e400 = e390 + e399; - const bool e401 = e400 < 2.5; - if(e401) { - const double e1 = 1.0 / e400; - const double e2 = e1 * e1; - const double e3 = e2 * e1; - const double p0_0 = force[e14]; - const double p0_1 = force[e19]; - const double p0_2 = force[e23]; - const double e7 = e3 - 0.5; - const double e441 = 48.0 * e3; - const double e442 = e441 * e7; - const double e443 = e442 * e1; - const double e10_0 = e371_0 * e443; - const double e10_1 = e371_1 * e443; - const double e10_2 = e371_2 * e443; - const double e11_0 = p0_0 + e10_0; - const double e11_1 = p0_1 + e10_1; - const double e11_2 = p0_2 + e10_2; - force[e14] = e11_0; - force[e19] = e11_1; - force[e23] = e11_2; - } + for(int i14 = 0; i14 < nlocal; i14++) { + const int e369 = i14 * neighborlist_capacity; + const int e376 = i14 * 3; + const double p23_0 = position[e376]; + const int e385 = i14 * 3; + const int e386 = e385 + 1; + const double p23_1 = position[e386]; + const int e395 = i14 * 3; + const int e396 = e395 + 2; + const double p23_2 = position[e396]; + const int e14 = i14 * 3; + const int e18 = i14 * 3; + const int e19 = e18 + 1; + const int e22 = i14 * 3; + const int e23 = e22 + 2; + const int a56 = numneighs[i14]; + for(int i15 = 0; i15 < a56; i15++) { + const int e370 = e369 + i15; + const int a57 = neighborlists[e370]; + const int e378 = a57 * 3; + const double p24_0 = position[e378]; + const int e387 = a57 * 3; + const int e388 = e387 + 1; + const double p24_1 = position[e388]; + const int e397 = a57 * 3; + const int e398 = e397 + 2; + const double p24_2 = position[e398]; + const double e371_0 = p23_0 - p24_0; + const double e371_1 = p23_1 - p24_1; + const double e371_2 = p23_2 - p24_2; + const double e380 = e371_0 * e371_0; + const double e389 = e371_1 * e371_1; + const double e390 = e380 + e389; + const double e399 = e371_2 * e371_2; + const double e400 = e390 + e399; + const bool e401 = e400 < 2.5; + if(e401) { + const double e1 = 1.0 / e400; + const double e2 = e1 * e1; + const double e3 = e2 * e1; + const double p0_0 = force[e14]; + const double p0_1 = force[e19]; + const double p0_2 = force[e23]; + const double e7 = e3 - 0.5; + const double e441 = 48.0 * e3; + const double e442 = e441 * e7; + const double e443 = e442 * e1; + const double e10_0 = e371_0 * e443; + const double e10_1 = e371_1 * e443; + const double e10_2 = e371_2 * e443; + const double e11_0 = p0_0 + e10_0; + const double e11_1 = p0_1 + e10_1; + const double e11_2 = p0_2 + e10_2; + force[e14] = e11_0; + force[e19] = e11_1; + force[e23] = e11_2; } } + } fprintf(stdout, "module_0 --- exit\n"); fflush(stdout); } void module_1(int nlocal, double *velocity, double *force, double *mass, double *position) { fprintf(stdout, "module_1 --- enter\n"); fflush(stdout); - for(int i0 = 0; i0 < nlocal; i0++) { - const int e31 = i0 * 3; - const double p1_0 = velocity[e31]; - const int e37 = i0 * 3; - const int e38 = e37 + 1; - const double p1_1 = velocity[e38]; - const int e43 = i0 * 3; - const int e44 = e43 + 2; - const double p1_2 = velocity[e44]; - const int e29 = i0 * 3; - const double p2_0 = force[e29]; - const int e35 = i0 * 3; - const int e36 = e35 + 1; - const double p2_1 = force[e36]; - const int e41 = i0 * 3; - const int e42 = e41 + 2; - const double p2_2 = force[e42]; - const double e24_0 = 0.005 * p2_0; - const double e24_1 = 0.005 * p2_1; - const double e24_2 = 0.005 * p2_2; - const double p3 = mass[i0]; - const double e25_0 = e24_0 / p3; - const double e25_1 = e24_1 / p3; - const double e25_2 = e24_2 / p3; - const double e26_0 = p1_0 + e25_0; - const double e26_1 = p1_1 + e25_1; - const double e26_2 = p1_2 + e25_2; - velocity[e31] = e26_0; - velocity[e38] = e26_1; - velocity[e44] = e26_2; - const int e51 = i0 * 3; - const double p4_0 = position[e51]; - const int e57 = i0 * 3; - const int e58 = e57 + 1; - const double p4_1 = position[e58]; - const int e63 = i0 * 3; - const int e64 = e63 + 2; - const double p4_2 = position[e64]; - const int e49 = i0 * 3; - const double p5_0 = velocity[e49]; - const int e55 = i0 * 3; - const int e56 = e55 + 1; - const double p5_1 = velocity[e56]; - const int e61 = i0 * 3; - const int e62 = e61 + 2; - const double p5_2 = velocity[e62]; - const double e45_0 = 0.005 * p5_0; - const double e45_1 = 0.005 * p5_1; - const double e45_2 = 0.005 * p5_2; - const double e46_0 = p4_0 + e45_0; - const double e46_1 = p4_1 + e45_1; - const double e46_2 = p4_2 + e45_2; - position[e51] = e46_0; - position[e58] = e46_1; - position[e64] = e46_2; - } + for(int i0 = 0; i0 < nlocal; i0++) { + const int e31 = i0 * 3; + const double p1_0 = velocity[e31]; + const int e37 = i0 * 3; + const int e38 = e37 + 1; + const double p1_1 = velocity[e38]; + const int e43 = i0 * 3; + const int e44 = e43 + 2; + const double p1_2 = velocity[e44]; + const int e29 = i0 * 3; + const double p2_0 = force[e29]; + const int e35 = i0 * 3; + const int e36 = e35 + 1; + const double p2_1 = force[e36]; + const int e41 = i0 * 3; + const int e42 = e41 + 2; + const double p2_2 = force[e42]; + const double e24_0 = 0.005 * p2_0; + const double e24_1 = 0.005 * p2_1; + const double e24_2 = 0.005 * p2_2; + const double p3 = mass[i0]; + const double e25_0 = e24_0 / p3; + const double e25_1 = e24_1 / p3; + const double e25_2 = e24_2 / p3; + const double e26_0 = p1_0 + e25_0; + const double e26_1 = p1_1 + e25_1; + const double e26_2 = p1_2 + e25_2; + velocity[e31] = e26_0; + velocity[e38] = e26_1; + velocity[e44] = e26_2; + const int e51 = i0 * 3; + const double p4_0 = position[e51]; + const int e57 = i0 * 3; + const int e58 = e57 + 1; + const double p4_1 = position[e58]; + const int e63 = i0 * 3; + const int e64 = e63 + 2; + const double p4_2 = position[e64]; + const int e49 = i0 * 3; + const double p5_0 = velocity[e49]; + const int e55 = i0 * 3; + const int e56 = e55 + 1; + const double p5_1 = velocity[e56]; + const int e61 = i0 * 3; + const int e62 = e61 + 2; + const double p5_2 = velocity[e62]; + const double e45_0 = 0.005 * p5_0; + const double e45_1 = 0.005 * p5_1; + const double e45_2 = 0.005 * p5_2; + const double e46_0 = p4_0 + e45_0; + const double e46_1 = p4_1 + e45_1; + const double e46_2 = p4_2 + e45_2; + position[e51] = e46_0; + position[e58] = e46_1; + position[e64] = e46_2; + } fprintf(stdout, "module_1 --- exit\n"); fflush(stdout); } void build_cell_lists_stencil(double grid0_d0_max, double grid0_d0_min, double grid0_d1_max, double grid0_d1_min, double grid0_d2_max, double grid0_d2_min, int ncells_capacity, int *ncells, int *nstencil, int *dim_cells, int *resizes, int *stencil) { fprintf(stdout, "build_cell_lists_stencil --- enter\n"); fflush(stdout); - const double e95 = grid0_d0_max - grid0_d0_min; - const double e96 = e95 / 2.8; - const int e97 = ceil(e96) + 2; - dim_cells[0] = e97; - const double e99 = grid0_d1_max - grid0_d1_min; - const double e100 = e99 / 2.8; - const int e101 = ceil(e100) + 2; - dim_cells[1] = e101; - const int a7 = dim_cells[0]; - const int a9 = dim_cells[1]; - const int e102 = a7 * a9; - const double e103 = grid0_d2_max - grid0_d2_min; - const double e104 = e103 / 2.8; - const int e105 = ceil(e104) + 2; - dim_cells[2] = e105; - const int a11 = dim_cells[2]; - const int e106 = e102 * a11; - const int e445 = e106 + 1; - const bool e446 = e445 >= ncells_capacity; - if(e446) { - resizes[0] = e106; - } else { - (*ncells) = e106; - } - (*nstencil) = 0; - for(int i2 = -1; i2 < 2; i2++) { - const int a12 = dim_cells[0]; - const int e107 = i2 * a12; - for(int i3 = -1; i3 < 2; i3++) { - const int e108 = e107 + i3; - const int a13 = dim_cells[1]; - const int e109 = e108 * a13; - for(int i4 = -1; i4 < 2; i4++) { - const int e110 = e109 + i4; - stencil[(*nstencil)] = e110; - const int e111 = (*nstencil) + 1; - (*nstencil) = e111; - } + const double e95 = grid0_d0_max - grid0_d0_min; + const double e96 = e95 / 2.8; + const int e97 = ceil(e96) + 2; + dim_cells[0] = e97; + const double e99 = grid0_d1_max - grid0_d1_min; + const double e100 = e99 / 2.8; + const int e101 = ceil(e100) + 2; + dim_cells[1] = e101; + const int a7 = dim_cells[0]; + const int a9 = dim_cells[1]; + const int e102 = a7 * a9; + const double e103 = grid0_d2_max - grid0_d2_min; + const double e104 = e103 / 2.8; + const int e105 = ceil(e104) + 2; + dim_cells[2] = e105; + const int a11 = dim_cells[2]; + const int e106 = e102 * a11; + const int e445 = e106 + 1; + const bool e446 = e445 >= ncells_capacity; + if(e446) { + resizes[0] = e106; + } else { + (*ncells) = e106; + } + (*nstencil) = 0; + for(int i2 = -1; i2 < 2; i2++) { + const int a12 = dim_cells[0]; + const int e107 = i2 * a12; + for(int i3 = -1; i3 < 2; i3++) { + const int e108 = e107 + i3; + const int a13 = dim_cells[1]; + const int e109 = e108 * a13; + for(int i4 = -1; i4 < 2; i4++) { + const int e110 = e109 + i4; + stencil[(*nstencil)] = e110; + const int e111 = (*nstencil) + 1; + (*nstencil) = e111; } } + } fprintf(stdout, "build_cell_lists_stencil --- exit\n"); fflush(stdout); } void enforce_pbc(double grid0_d0_max, double grid0_d0_min, double grid0_d1_max, double grid0_d1_min, double grid0_d2_max, double grid0_d2_min, int nlocal, double *position) { fprintf(stdout, "enforce_pbc --- enter\n"); fflush(stdout); - const double e118 = grid0_d0_max - grid0_d0_min; - const double e125 = grid0_d0_max - grid0_d0_min; - const double e132 = grid0_d1_max - grid0_d1_min; - const double e139 = grid0_d1_max - grid0_d1_min; - const double e146 = grid0_d2_max - grid0_d2_min; - const double e153 = grid0_d2_max - grid0_d2_min; - for(int i5 = 0; i5 < nlocal; i5++) { - const int e123 = i5 * 3; - const double p6_0 = position[e123]; - const int e137 = i5 * 3; - const int e138 = e137 + 1; - const double p6_1 = position[e138]; - const int e151 = i5 * 3; - const int e152 = e151 + 2; - const double p6_2 = position[e152]; - const bool e115 = p6_0 < grid0_d0_min; - if(e115) { - const double e119 = p6_0 + e118; - position[e123] = e119; - } - const bool e122 = p6_0 > grid0_d0_max; - if(e122) { - const double e126 = p6_0 - e125; - position[e123] = e126; - } - const bool e129 = p6_1 < grid0_d1_min; - if(e129) { - const double e133 = p6_1 + e132; - position[e138] = e133; - } - const bool e136 = p6_1 > grid0_d1_max; - if(e136) { - const double e140 = p6_1 - e139; - position[e138] = e140; - } - const bool e143 = p6_2 < grid0_d2_min; - if(e143) { - const double e147 = p6_2 + e146; - position[e152] = e147; - } - const bool e150 = p6_2 > grid0_d2_max; - if(e150) { - const double e154 = p6_2 - e153; - position[e152] = e154; - } + const double e118 = grid0_d0_max - grid0_d0_min; + const double e125 = grid0_d0_max - grid0_d0_min; + const double e132 = grid0_d1_max - grid0_d1_min; + const double e139 = grid0_d1_max - grid0_d1_min; + const double e146 = grid0_d2_max - grid0_d2_min; + const double e153 = grid0_d2_max - grid0_d2_min; + for(int i5 = 0; i5 < nlocal; i5++) { + const int e123 = i5 * 3; + const double p6_0 = position[e123]; + const int e137 = i5 * 3; + const int e138 = e137 + 1; + const double p6_1 = position[e138]; + const int e151 = i5 * 3; + const int e152 = e151 + 2; + const double p6_2 = position[e152]; + const bool e115 = p6_0 < grid0_d0_min; + if(e115) { + const double e119 = p6_0 + e118; + position[e123] = e119; + } + const bool e122 = p6_0 > grid0_d0_max; + if(e122) { + const double e126 = p6_0 - e125; + position[e123] = e126; + } + const bool e129 = p6_1 < grid0_d1_min; + if(e129) { + const double e133 = p6_1 + e132; + position[e138] = e133; + } + const bool e136 = p6_1 > grid0_d1_max; + if(e136) { + const double e140 = p6_1 - e139; + position[e138] = e140; } + const bool e143 = p6_2 < grid0_d2_min; + if(e143) { + const double e147 = p6_2 + e146; + position[e152] = e147; + } + const bool e150 = p6_2 > grid0_d2_max; + if(e150) { + const double e154 = p6_2 - e153; + position[e152] = e154; + } + } fprintf(stdout, "enforce_pbc --- exit\n"); fflush(stdout); } void setup_pbc(double grid0_d0_max, double grid0_d0_min, int pbc_capacity, double grid0_d1_max, double grid0_d1_min, double grid0_d2_max, double grid0_d2_min, int *npbc, int *nlocal, int *pbc_map, int *pbc_mult, int *resizes, double *position) { fprintf(stdout, "setup_pbc --- enter\n"); fflush(stdout); - (*npbc) = 0; - const int e155 = (*nlocal) + (*npbc); - const double e157 = grid0_d0_max - grid0_d0_min; - const double e160 = grid0_d0_min + 2.8; - const double e184 = grid0_d0_max - 2.8; - for(int i6 = 0; i6 < e155; i6++) { - const int e190 = i6 * 3; - const double p7_0 = position[e190]; - const int e197 = i6 * 3; - const int e198 = e197 + 1; - const double p7_1 = position[e198]; - const int e203 = i6 * 3; - const int e204 = e203 + 2; - const double p7_2 = position[e204]; - const int e156 = (*nlocal) + (*npbc); - const int e188 = e156 * 3; - const double p8_0 = position[e188]; - const int e195 = e156 * 3; - const int e196 = e195 + 1; - const double p8_1 = position[e196]; - const int e201 = e156 * 3; - const int e202 = e201 + 2; - const double p8_2 = position[e202]; - const bool e161 = p7_0 < e160; - if(e161) { - pbc_map[(*npbc)] = i6; - const int e162 = (*npbc) * 3; - pbc_mult[e162] = 1; - const double e168 = p7_0 + e157; - position[e188] = e168; - const int e169 = (*npbc) * 3; - const int e170 = e169 + 1; - pbc_mult[e170] = 0; - position[e196] = p7_1; - const int e175 = (*npbc) * 3; - const int e176 = e175 + 2; - pbc_mult[e176] = 0; - position[e202] = p7_2; - const int e181 = (*npbc) + 1; - const int e447 = e181 + 1; - const bool e448 = e447 >= pbc_capacity; - if(e448) { - resizes[0] = e181; - } else { - (*npbc) = e181; - } + (*npbc) = 0; + const int e155 = (*nlocal) + (*npbc); + const double e157 = grid0_d0_max - grid0_d0_min; + const double e160 = grid0_d0_min + 2.8; + const double e184 = grid0_d0_max - 2.8; + for(int i6 = 0; i6 < e155; i6++) { + const int e190 = i6 * 3; + const double p7_0 = position[e190]; + const int e197 = i6 * 3; + const int e198 = e197 + 1; + const double p7_1 = position[e198]; + const int e203 = i6 * 3; + const int e204 = e203 + 2; + const double p7_2 = position[e204]; + const int e156 = (*nlocal) + (*npbc); + const int e188 = e156 * 3; + const double p8_0 = position[e188]; + const int e195 = e156 * 3; + const int e196 = e195 + 1; + const double p8_1 = position[e196]; + const int e201 = e156 * 3; + const int e202 = e201 + 2; + const double p8_2 = position[e202]; + const bool e161 = p7_0 < e160; + if(e161) { + pbc_map[(*npbc)] = i6; + const int e162 = (*npbc) * 3; + pbc_mult[e162] = 1; + const double e168 = p7_0 + e157; + position[e188] = e168; + const int e169 = (*npbc) * 3; + const int e170 = e169 + 1; + pbc_mult[e170] = 0; + position[e196] = p7_1; + const int e175 = (*npbc) * 3; + const int e176 = e175 + 2; + pbc_mult[e176] = 0; + position[e202] = p7_2; + const int e181 = (*npbc) + 1; + const int e447 = e181 + 1; + const bool e448 = e447 >= pbc_capacity; + if(e448) { + resizes[0] = e181; + } else { + (*npbc) = e181; } - const bool e185 = p7_0 > e184; - if(e185) { - pbc_map[(*npbc)] = i6; - const int e186 = (*npbc) * 3; - pbc_mult[e186] = -1; - const double e192 = p7_0 - e157; - position[e188] = e192; - const int e193 = (*npbc) * 3; - const int e194 = e193 + 1; - pbc_mult[e194] = 0; - position[e196] = p7_1; - const int e199 = (*npbc) * 3; - const int e200 = e199 + 2; - pbc_mult[e200] = 0; - position[e202] = p7_2; - const int e205 = (*npbc) + 1; - const int e449 = e205 + 1; - const bool e450 = e449 >= pbc_capacity; - if(e450) { - resizes[0] = e205; - } else { - (*npbc) = e205; - } + } + const bool e185 = p7_0 > e184; + if(e185) { + pbc_map[(*npbc)] = i6; + const int e186 = (*npbc) * 3; + pbc_mult[e186] = -1; + const double e192 = p7_0 - e157; + position[e188] = e192; + const int e193 = (*npbc) * 3; + const int e194 = e193 + 1; + pbc_mult[e194] = 0; + position[e196] = p7_1; + const int e199 = (*npbc) * 3; + const int e200 = e199 + 2; + pbc_mult[e200] = 0; + position[e202] = p7_2; + const int e205 = (*npbc) + 1; + const int e449 = e205 + 1; + const bool e450 = e449 >= pbc_capacity; + if(e450) { + resizes[0] = e205; + } else { + (*npbc) = e205; } } - const int e206 = (*nlocal) + (*npbc); - const double e208 = grid0_d1_max - grid0_d1_min; - const double e211 = grid0_d1_min + 2.8; - const double e235 = grid0_d1_max - 2.8; - for(int i7 = 0; i7 < e206; i7++) { - const int e248 = i7 * 3; - const double p9_0 = position[e248]; - const int e241 = i7 * 3; - const int e242 = e241 + 1; - const double p9_1 = position[e242]; - const int e254 = i7 * 3; - const int e255 = e254 + 2; - const double p9_2 = position[e255]; - const int e207 = (*nlocal) + (*npbc); - const int e246 = e207 * 3; - const double p10_0 = position[e246]; - const int e239 = e207 * 3; - const int e240 = e239 + 1; - const double p10_1 = position[e240]; - const int e252 = e207 * 3; - const int e253 = e252 + 2; - const double p10_2 = position[e253]; - const bool e212 = p9_1 < e211; - if(e212) { - pbc_map[(*npbc)] = i7; - const int e213 = (*npbc) * 3; - const int e214 = e213 + 1; - pbc_mult[e214] = 1; - const double e219 = p9_1 + e208; - position[e240] = e219; - const int e220 = (*npbc) * 3; - pbc_mult[e220] = 0; - position[e246] = p9_0; - const int e226 = (*npbc) * 3; - const int e227 = e226 + 2; - pbc_mult[e227] = 0; - position[e253] = p9_2; - const int e232 = (*npbc) + 1; - const int e451 = e232 + 1; - const bool e452 = e451 >= pbc_capacity; - if(e452) { - resizes[0] = e232; - } else { - (*npbc) = e232; - } + } + const int e206 = (*nlocal) + (*npbc); + const double e208 = grid0_d1_max - grid0_d1_min; + const double e211 = grid0_d1_min + 2.8; + const double e235 = grid0_d1_max - 2.8; + for(int i7 = 0; i7 < e206; i7++) { + const int e248 = i7 * 3; + const double p9_0 = position[e248]; + const int e241 = i7 * 3; + const int e242 = e241 + 1; + const double p9_1 = position[e242]; + const int e254 = i7 * 3; + const int e255 = e254 + 2; + const double p9_2 = position[e255]; + const int e207 = (*nlocal) + (*npbc); + const int e246 = e207 * 3; + const double p10_0 = position[e246]; + const int e239 = e207 * 3; + const int e240 = e239 + 1; + const double p10_1 = position[e240]; + const int e252 = e207 * 3; + const int e253 = e252 + 2; + const double p10_2 = position[e253]; + const bool e212 = p9_1 < e211; + if(e212) { + pbc_map[(*npbc)] = i7; + const int e213 = (*npbc) * 3; + const int e214 = e213 + 1; + pbc_mult[e214] = 1; + const double e219 = p9_1 + e208; + position[e240] = e219; + const int e220 = (*npbc) * 3; + pbc_mult[e220] = 0; + position[e246] = p9_0; + const int e226 = (*npbc) * 3; + const int e227 = e226 + 2; + pbc_mult[e227] = 0; + position[e253] = p9_2; + const int e232 = (*npbc) + 1; + const int e451 = e232 + 1; + const bool e452 = e451 >= pbc_capacity; + if(e452) { + resizes[0] = e232; + } else { + (*npbc) = e232; } - const bool e236 = p9_1 > e235; - if(e236) { - pbc_map[(*npbc)] = i7; - const int e237 = (*npbc) * 3; - const int e238 = e237 + 1; - pbc_mult[e238] = -1; - const double e243 = p9_1 - e208; - position[e240] = e243; - const int e244 = (*npbc) * 3; - pbc_mult[e244] = 0; - position[e246] = p9_0; - const int e250 = (*npbc) * 3; - const int e251 = e250 + 2; - pbc_mult[e251] = 0; - position[e253] = p9_2; - const int e256 = (*npbc) + 1; - const int e453 = e256 + 1; - const bool e454 = e453 >= pbc_capacity; - if(e454) { - resizes[0] = e256; - } else { - (*npbc) = e256; - } + } + const bool e236 = p9_1 > e235; + if(e236) { + pbc_map[(*npbc)] = i7; + const int e237 = (*npbc) * 3; + const int e238 = e237 + 1; + pbc_mult[e238] = -1; + const double e243 = p9_1 - e208; + position[e240] = e243; + const int e244 = (*npbc) * 3; + pbc_mult[e244] = 0; + position[e246] = p9_0; + const int e250 = (*npbc) * 3; + const int e251 = e250 + 2; + pbc_mult[e251] = 0; + position[e253] = p9_2; + const int e256 = (*npbc) + 1; + const int e453 = e256 + 1; + const bool e454 = e453 >= pbc_capacity; + if(e454) { + resizes[0] = e256; + } else { + (*npbc) = e256; } } - const int e257 = (*nlocal) + (*npbc); - const double e259 = grid0_d2_max - grid0_d2_min; - const double e262 = grid0_d2_min + 2.8; - const double e286 = grid0_d2_max - 2.8; - for(int i8 = 0; i8 < e257; i8++) { - const int e299 = i8 * 3; - const double p11_0 = position[e299]; - const int e305 = i8 * 3; - const int e306 = e305 + 1; - const double p11_1 = position[e306]; - const int e292 = i8 * 3; - const int e293 = e292 + 2; - const double p11_2 = position[e293]; - const int e258 = (*nlocal) + (*npbc); - const int e297 = e258 * 3; - const double p12_0 = position[e297]; - const int e303 = e258 * 3; - const int e304 = e303 + 1; - const double p12_1 = position[e304]; - const int e290 = e258 * 3; - const int e291 = e290 + 2; - const double p12_2 = position[e291]; - const bool e263 = p11_2 < e262; - if(e263) { - pbc_map[(*npbc)] = i8; - const int e264 = (*npbc) * 3; - const int e265 = e264 + 2; - pbc_mult[e265] = 1; - const double e270 = p11_2 + e259; - position[e291] = e270; - const int e271 = (*npbc) * 3; - pbc_mult[e271] = 0; - position[e297] = p11_0; - const int e277 = (*npbc) * 3; - const int e278 = e277 + 1; - pbc_mult[e278] = 0; - position[e304] = p11_1; - const int e283 = (*npbc) + 1; - const int e455 = e283 + 1; - const bool e456 = e455 >= pbc_capacity; - if(e456) { - resizes[0] = e283; - } else { - (*npbc) = e283; - } + } + const int e257 = (*nlocal) + (*npbc); + const double e259 = grid0_d2_max - grid0_d2_min; + const double e262 = grid0_d2_min + 2.8; + const double e286 = grid0_d2_max - 2.8; + for(int i8 = 0; i8 < e257; i8++) { + const int e299 = i8 * 3; + const double p11_0 = position[e299]; + const int e305 = i8 * 3; + const int e306 = e305 + 1; + const double p11_1 = position[e306]; + const int e292 = i8 * 3; + const int e293 = e292 + 2; + const double p11_2 = position[e293]; + const int e258 = (*nlocal) + (*npbc); + const int e297 = e258 * 3; + const double p12_0 = position[e297]; + const int e303 = e258 * 3; + const int e304 = e303 + 1; + const double p12_1 = position[e304]; + const int e290 = e258 * 3; + const int e291 = e290 + 2; + const double p12_2 = position[e291]; + const bool e263 = p11_2 < e262; + if(e263) { + pbc_map[(*npbc)] = i8; + const int e264 = (*npbc) * 3; + const int e265 = e264 + 2; + pbc_mult[e265] = 1; + const double e270 = p11_2 + e259; + position[e291] = e270; + const int e271 = (*npbc) * 3; + pbc_mult[e271] = 0; + position[e297] = p11_0; + const int e277 = (*npbc) * 3; + const int e278 = e277 + 1; + pbc_mult[e278] = 0; + position[e304] = p11_1; + const int e283 = (*npbc) + 1; + const int e455 = e283 + 1; + const bool e456 = e455 >= pbc_capacity; + if(e456) { + resizes[0] = e283; + } else { + (*npbc) = e283; } - const bool e287 = p11_2 > e286; - if(e287) { - pbc_map[(*npbc)] = i8; - const int e288 = (*npbc) * 3; - const int e289 = e288 + 2; - pbc_mult[e289] = -1; - const double e294 = p11_2 - e259; - position[e291] = e294; - const int e295 = (*npbc) * 3; - pbc_mult[e295] = 0; - position[e297] = p11_0; - const int e301 = (*npbc) * 3; - const int e302 = e301 + 1; - pbc_mult[e302] = 0; - position[e304] = p11_1; - const int e307 = (*npbc) + 1; - const int e457 = e307 + 1; - const bool e458 = e457 >= pbc_capacity; - if(e458) { - resizes[0] = e307; - } else { - (*npbc) = e307; - } + } + const bool e287 = p11_2 > e286; + if(e287) { + pbc_map[(*npbc)] = i8; + const int e288 = (*npbc) * 3; + const int e289 = e288 + 2; + pbc_mult[e289] = -1; + const double e294 = p11_2 - e259; + position[e291] = e294; + const int e295 = (*npbc) * 3; + pbc_mult[e295] = 0; + position[e297] = p11_0; + const int e301 = (*npbc) * 3; + const int e302 = e301 + 1; + pbc_mult[e302] = 0; + position[e304] = p11_1; + const int e307 = (*npbc) + 1; + const int e457 = e307 + 1; + const bool e458 = e457 >= pbc_capacity; + if(e458) { + resizes[0] = e307; + } else { + (*npbc) = e307; } } + } fprintf(stdout, "setup_pbc --- exit\n"); fflush(stdout); } void update_pbc(double grid0_d0_max, double grid0_d0_min, double grid0_d1_max, double grid0_d1_min, double grid0_d2_max, double grid0_d2_min, int npbc, int *nlocal, int *pbc_map, int *pbc_mult, double *position) { fprintf(stdout, "update_pbc --- enter\n"); fflush(stdout); - const double e315 = grid0_d0_max - grid0_d0_min; - const double e325 = grid0_d1_max - grid0_d1_min; - const double e335 = grid0_d2_max - grid0_d2_min; - for(int i9 = 0; i9 < npbc; i9++) { - const int e308 = (*nlocal) + i9; - const int e309 = e308 * 3; - const double p13_0 = position[e309]; - const int a39 = pbc_map[i9]; - const int e311 = a39 * 3; - const double p14_0 = position[e311]; - const int e313 = i9 * 3; - const int a40 = pbc_mult[e313]; - const double e316 = a40 * e315; - const double e317 = p14_0 + e316; - position[e309] = e317; - const int e318 = (*nlocal) + i9; - const int e319 = e318 * 3; - const int e320 = e319 + 1; - const double p15_1 = position[e320]; - const int a41 = pbc_map[i9]; - const int e321 = a41 * 3; - const int e322 = e321 + 1; - const double p16_1 = position[e322]; - const int e323 = i9 * 3; - const int e324 = e323 + 1; - const int a42 = pbc_mult[e324]; - const double e326 = a42 * e325; - const double e327 = p16_1 + e326; - position[e320] = e327; - const int e328 = (*nlocal) + i9; - const int e329 = e328 * 3; - const int e330 = e329 + 2; - const double p17_2 = position[e330]; - const int a43 = pbc_map[i9]; - const int e331 = a43 * 3; - const int e332 = e331 + 2; - const double p18_2 = position[e332]; - const int e333 = i9 * 3; - const int e334 = e333 + 2; - const int a44 = pbc_mult[e334]; - const double e336 = a44 * e335; - const double e337 = p18_2 + e336; - position[e330] = e337; - } + const double e315 = grid0_d0_max - grid0_d0_min; + const double e325 = grid0_d1_max - grid0_d1_min; + const double e335 = grid0_d2_max - grid0_d2_min; + for(int i9 = 0; i9 < npbc; i9++) { + const int e308 = (*nlocal) + i9; + const int e309 = e308 * 3; + const double p13_0 = position[e309]; + const int a39 = pbc_map[i9]; + const int e311 = a39 * 3; + const double p14_0 = position[e311]; + const int e313 = i9 * 3; + const int a40 = pbc_mult[e313]; + const int e316 = a40 * e315; + const double e317 = p14_0 + e316; + position[e309] = e317; + const int e318 = (*nlocal) + i9; + const int e319 = e318 * 3; + const int e320 = e319 + 1; + const double p15_1 = position[e320]; + const int a41 = pbc_map[i9]; + const int e321 = a41 * 3; + const int e322 = e321 + 1; + const double p16_1 = position[e322]; + const int e323 = i9 * 3; + const int e324 = e323 + 1; + const int a42 = pbc_mult[e324]; + const int e326 = a42 * e325; + const double e327 = p16_1 + e326; + position[e320] = e327; + const int e328 = (*nlocal) + i9; + const int e329 = e328 * 3; + const int e330 = e329 + 2; + const double p17_2 = position[e330]; + const int a43 = pbc_map[i9]; + const int e331 = a43 * 3; + const int e332 = e331 + 2; + const double p18_2 = position[e332]; + const int e333 = i9 * 3; + const int e334 = e333 + 2; + const int a44 = pbc_mult[e334]; + const int e336 = a44 * e335; + const double e337 = p18_2 + e336; + position[e330] = e337; + } fprintf(stdout, "update_pbc --- exit\n"); fflush(stdout); } void build_cell_lists(int ncells, int nlocal, int npbc, double *grid0_d0_min, double *grid0_d1_min, double *grid0_d2_min, int *cell_capacity, int *cell_sizes, int *dim_cells, int *particle_cell, int *cell_particles, int *resizes, double *position) { fprintf(stdout, "build_cell_lists --- enter\n"); fflush(stdout); - for(int i10 = 0; i10 < ncells; i10++) { - cell_sizes[i10] = 0; - } - const int e500 = nlocal + npbc; - for(int i11 = 0; i11 < e500; i11++) { - const int e338 = i11 * 3; - const double p19_0 = position[e338]; - const double e340 = p19_0 - (*grid0_d0_min); - const double e341 = e340 / 2.8; - const int e342 = i11 * 3; - const int e343 = e342 + 1; - const double p20_1 = position[e343]; - const double e344 = p20_1 - (*grid0_d1_min); - const double e345 = e344 / 2.8; - const int e346 = i11 * 3; - const int e347 = e346 + 2; - const double p21_2 = position[e347]; - const double e348 = p21_2 - (*grid0_d2_min); - const double e349 = e348 / 2.8; - const int a46 = dim_cells[1]; - const int e350 = (int)(e341) * a46; - const int e351 = e350 + (int)(e345); - const int a47 = dim_cells[2]; - const int e352 = e351 * a47; - const int e353 = e352 + (int)(e349); - const bool e354 = e353 >= 0; - const bool e355 = e353 <= ncells; - const bool e356 = e354 && e355; - if(e356) { - particle_cell[i11] = e353; - const int e357 = e353 * (*cell_capacity); - const int a48 = cell_sizes[e353]; - const int e358 = e357 + a48; - cell_particles[e358] = i11; - const int e359 = a48 + 1; - const int e459 = e359 + 1; - const bool e460 = e459 >= (*cell_capacity); - if(e460) { - resizes[0] = e359; - } else { - cell_sizes[e353] = e359; - } + for(int i10 = 0; i10 < ncells; i10++) { + cell_sizes[i10] = 0; + } + const int e542 = nlocal + npbc; + for(int i11 = 0; i11 < e542; i11++) { + const int e338 = i11 * 3; + const double p19_0 = position[e338]; + const double e340 = p19_0 - (*grid0_d0_min); + const double e341 = e340 / 2.8; + const int e342 = i11 * 3; + const int e343 = e342 + 1; + const double p20_1 = position[e343]; + const double e344 = p20_1 - (*grid0_d1_min); + const double e345 = e344 / 2.8; + const int e346 = i11 * 3; + const int e347 = e346 + 2; + const double p21_2 = position[e347]; + const double e348 = p21_2 - (*grid0_d2_min); + const double e349 = e348 / 2.8; + const int a46 = dim_cells[1]; + const int e350 = (int)(e341) * a46; + const int e351 = e350 + (int)(e345); + const int a47 = dim_cells[2]; + const int e352 = e351 * a47; + const int e353 = e352 + (int)(e349); + const bool e354 = e353 >= 0; + const bool e355 = e353 <= ncells; + const bool e356 = e354 && e355; + if(e356) { + particle_cell[i11] = e353; + const int e357 = e353 * (*cell_capacity); + const int a48 = cell_sizes[e353]; + const int e358 = e357 + a48; + cell_particles[e358] = i11; + const int e359 = a48 + 1; + const int e459 = e359 + 1; + const bool e460 = e459 >= (*cell_capacity); + if(e460) { + resizes[0] = e359; + } else { + cell_sizes[e353] = e359; } } + } fprintf(stdout, "build_cell_lists --- exit\n"); fflush(stdout); } void neighbor_lists_build(int nlocal, int ncells, int cell_capacity, int nstencil, int *neighborlist_capacity, int *numneighs, int *particle_cell, int *stencil, int *cell_particles, int *neighborlists, int *resizes, int *cell_sizes, double *position) { fprintf(stdout, "neighbor_lists_build --- enter\n"); fflush(stdout); - for(int i12 = 0; i12 < nlocal; i12++) { - numneighs[i12] = 0; - } - for(int i16 = 0; i16 < nlocal; i16++) { - for(int i17 = 0; i17 < nstencil; i17++) { - const int a58 = particle_cell[i16]; - const int a59 = stencil[i17]; - const int e403 = a58 + a59; - const bool e404 = e403 >= 0; - const bool e405 = e403 <= ncells; - const bool e406 = e404 && e405; - if(e406) { - const int e407 = e403 * cell_capacity; - const int e415 = i16 * 3; - const double p25_0 = position[e415]; - const int e424 = i16 * 3; - const int e425 = e424 + 1; - const double p25_1 = position[e425]; - const int e434 = i16 * 3; - const int e435 = e434 + 2; - const double p25_2 = position[e435]; - const int e360 = i16 * (*neighborlist_capacity); - const int a60 = cell_sizes[e403]; - for(int i18 = 0; i18 < a60; i18++) { - const int e408 = e407 + i18; - const int a61 = cell_particles[e408]; - const bool e409 = a61 != i16; - if(e409) { - const int e417 = a61 * 3; - const double p26_0 = position[e417]; - const int e426 = a61 * 3; - const int e427 = e426 + 1; - const double p26_1 = position[e427]; - const int e436 = a61 * 3; - const int e437 = e436 + 2; - const double p26_2 = position[e437]; - const double e410_0 = p25_0 - p26_0; - const double e410_1 = p25_1 - p26_1; - const double e410_2 = p25_2 - p26_2; - const double e419 = e410_0 * e410_0; - const double e428 = e410_1 * e410_1; - const double e429 = e419 + e428; - const double e438 = e410_2 * e410_2; - const double e439 = e429 + e438; - const bool e440 = e439 < 2.8; - if(e440) { - const int a53 = numneighs[i16]; - const int e361 = e360 + a53; - neighborlists[e361] = a61; - const int e362 = a53 + 1; - const int e461 = e362 + 1; - const bool e462 = e461 >= (*neighborlist_capacity); - if(e462) { - resizes[0] = e362; - } else { - numneighs[i16] = e362; - } + for(int i12 = 0; i12 < nlocal; i12++) { + numneighs[i12] = 0; + } + for(int i16 = 0; i16 < nlocal; i16++) { + for(int i17 = 0; i17 < nstencil; i17++) { + const int a58 = particle_cell[i16]; + const int a59 = stencil[i17]; + const int e403 = a58 + a59; + const bool e404 = e403 >= 0; + const bool e405 = e403 <= ncells; + const bool e406 = e404 && e405; + if(e406) { + const int e407 = e403 * cell_capacity; + const int e415 = i16 * 3; + const double p25_0 = position[e415]; + const int e424 = i16 * 3; + const int e425 = e424 + 1; + const double p25_1 = position[e425]; + const int e434 = i16 * 3; + const int e435 = e434 + 2; + const double p25_2 = position[e435]; + const int e360 = i16 * (*neighborlist_capacity); + const int a60 = cell_sizes[e403]; + for(int i18 = 0; i18 < a60; i18++) { + const int e408 = e407 + i18; + const int a61 = cell_particles[e408]; + const bool e409 = a61 != i16; + if(e409) { + const int e417 = a61 * 3; + const double p26_0 = position[e417]; + const int e426 = a61 * 3; + const int e427 = e426 + 1; + const double p26_1 = position[e427]; + const int e436 = a61 * 3; + const int e437 = e436 + 2; + const double p26_2 = position[e437]; + const double e410_0 = p25_0 - p26_0; + const double e410_1 = p25_1 - p26_1; + const double e410_2 = p25_2 - p26_2; + const double e419 = e410_0 * e410_0; + const double e428 = e410_1 * e410_1; + const double e429 = e419 + e428; + const double e438 = e410_2 * e410_2; + const double e439 = e429 + e438; + const bool e440 = e439 < 2.8; + if(e440) { + const int a53 = numneighs[i16]; + const int e361 = e360 + a53; + neighborlists[e361] = a61; + const int e362 = a53 + 1; + const int e461 = e362 + 1; + const bool e462 = e461 >= (*neighborlist_capacity); + if(e462) { + resizes[0] = e362; + } else { + numneighs[i16] = e362; } } } } } } + } fprintf(stdout, "neighbor_lists_build --- exit\n"); fflush(stdout); } void reset_volatile_properties(int nlocal, double *force) { fprintf(stdout, "reset_volatile_properties --- enter\n"); fflush(stdout); - for(int i13 = 0; i13 < nlocal; i13++) { - const int e363 = i13 * 3; - const double p22_0 = force[e363]; - const int e365 = i13 * 3; - const int e366 = e365 + 1; - const double p22_1 = force[e366]; - const int e367 = i13 * 3; - const int e368 = e367 + 2; - const double p22_2 = force[e368]; - force[e363] = 0.0; - force[e366] = 0.0; - force[e368] = 0.0; - } + for(int i13 = 0; i13 < nlocal; i13++) { + const int e363 = i13 * 3; + const double p22_0 = force[e363]; + const int e365 = i13 * 3; + const int e366 = e365 + 1; + const double p22_1 = force[e366]; + const int e367 = i13 * 3; + const int e368 = e367 + 2; + const double p22_2 = force[e368]; + force[e363] = 0.0; + force[e366] = 0.0; + force[e368] = 0.0; + } fprintf(stdout, "reset_volatile_properties --- exit\n"); fflush(stdout); } @@ -671,6 +671,8 @@ int main() { int *numneighs = (int *) malloc((sizeof(int) * particle_capacity)); int *pbc_map = (int *) malloc((sizeof(int) * pbc_capacity)); int *pbc_mult = (int *) malloc((sizeof(int) * (pbc_capacity * 3))); + unsigned long long int prop_hflags[1] = {18446744073709551615}; + unsigned long long int prop_dflags[1] = {0}; double *mass = (double *) malloc((sizeof(double) * (particle_capacity + pbc_capacity))); ps->addProperty(Property(0, "mass", mass, Prop_Float)); double *position = (double *) malloc((sizeof(double) * ((particle_capacity + pbc_capacity) * 3))); @@ -696,6 +698,12 @@ int main() { resizes[0] = 1; while((resizes[0] > 0)) { resizes[0] = 0; + const unsigned long long int a92 = prop_dflags[0]; + const unsigned long long int e500 = a92 | 0; + prop_dflags[0] = e500; + const unsigned long long int a94 = prop_hflags[0]; + const unsigned long long int e501 = a94 & -1; + prop_hflags[0] = e501; build_cell_lists_stencil(grid0_d0_max, grid0_d0_min, grid0_d1_max, grid0_d1_min, grid0_d2_max, grid0_d2_min, ncells_capacity, &ncells, &nstencil, dim_cells, resizes, stencil); const int a74 = resizes[0]; const bool e464 = a74 > 0; @@ -712,12 +720,36 @@ int main() { pairs::vtk_write_data(ps, "output/test_pbc", nlocal, e112, 0); for(int i1 = 0; i1 < 101; i1++) { if(((i1 % 20) == 0)) { + const unsigned long long int a95 = prop_dflags[0]; + const unsigned long long int e502 = a95 & 2; + const bool e503 = e502 == 0; + if(e503) { + pairs::copy_to_device(position) + } + const unsigned long long int a97 = prop_dflags[0]; + const unsigned long long int e504 = a97 | 2; + prop_dflags[0] = e504; + const unsigned long long int a99 = prop_hflags[0]; + const unsigned long long int e505 = a99 & -3; + prop_hflags[0] = e505; enforce_pbc(grid0_d0_max, grid0_d0_min, grid0_d1_max, grid0_d1_min, grid0_d2_max, grid0_d2_min, nlocal, position); } if(((i1 % 20) == 0)) { resizes[0] = 1; while((resizes[0] > 0)) { resizes[0] = 0; + const unsigned long long int a100 = prop_dflags[0]; + const unsigned long long int e506 = a100 & 2; + const bool e507 = e506 == 0; + if(e507) { + pairs::copy_to_device(position) + } + const unsigned long long int a102 = prop_dflags[0]; + const unsigned long long int e508 = a102 | 2; + prop_dflags[0] = e508; + const unsigned long long int a104 = prop_hflags[0]; + const unsigned long long int e509 = a104 & -3; + prop_hflags[0] = e509; setup_pbc(grid0_d0_max, grid0_d0_min, pbc_capacity, grid0_d1_max, grid0_d1_min, grid0_d2_max, grid0_d2_min, &npbc, &nlocal, pbc_map, pbc_mult, resizes, position); const int a79 = resizes[0]; const bool e485 = a79 > 0; @@ -738,12 +770,36 @@ int main() { } } } else { + const unsigned long long int a105 = prop_dflags[0]; + const unsigned long long int e510 = a105 & 2; + const bool e511 = e510 == 0; + if(e511) { + pairs::copy_to_device(position) + } + const unsigned long long int a107 = prop_dflags[0]; + const unsigned long long int e512 = a107 | 2; + prop_dflags[0] = e512; + const unsigned long long int a109 = prop_hflags[0]; + const unsigned long long int e513 = a109 & -3; + prop_hflags[0] = e513; update_pbc(grid0_d0_max, grid0_d0_min, grid0_d1_max, grid0_d1_min, grid0_d2_max, grid0_d2_min, npbc, &nlocal, pbc_map, pbc_mult, position); } if(((i1 % 20) == 0)) { resizes[0] = 1; while((resizes[0] > 0)) { resizes[0] = 0; + const unsigned long long int a110 = prop_dflags[0]; + const unsigned long long int e514 = a110 & 2; + const bool e515 = e514 == 0; + if(e515) { + pairs::copy_to_device(position) + } + const unsigned long long int a112 = prop_dflags[0]; + const unsigned long long int e516 = a112 | 2; + prop_dflags[0] = e516; + const unsigned long long int a114 = prop_hflags[0]; + const unsigned long long int e517 = a114 & -3; + prop_hflags[0] = e517; build_cell_lists(ncells, nlocal, npbc, &grid0_d0_min, &grid0_d1_min, &grid0_d2_min, &cell_capacity, cell_sizes, dim_cells, particle_cell, cell_particles, resizes, position); const int a84 = resizes[0]; const bool e491 = a84 > 0; @@ -759,6 +815,18 @@ int main() { resizes[0] = 1; while((resizes[0] > 0)) { resizes[0] = 0; + const unsigned long long int a115 = prop_dflags[0]; + const unsigned long long int e518 = a115 & 2; + const bool e519 = e518 == 0; + if(e519) { + pairs::copy_to_device(position) + } + const unsigned long long int a117 = prop_dflags[0]; + const unsigned long long int e520 = a117 | 2; + prop_dflags[0] = e520; + const unsigned long long int a119 = prop_hflags[0]; + const unsigned long long int e521 = a119 & -1; + prop_hflags[0] = e521; neighbor_lists_build(nlocal, ncells, cell_capacity, nstencil, &neighborlist_capacity, numneighs, particle_cell, stencil, cell_particles, neighborlists, resizes, cell_sizes, position); const int a89 = resizes[0]; const bool e496 = a89 > 0; @@ -770,8 +838,68 @@ int main() { } } } + const unsigned long long int a120 = prop_dflags[0]; + const unsigned long long int e522 = a120 & 8; + const bool e523 = e522 == 0; + if(e523) { + pairs::copy_to_device(force) + } + const unsigned long long int a122 = prop_dflags[0]; + const unsigned long long int e524 = a122 | 8; + prop_dflags[0] = e524; + const unsigned long long int a124 = prop_hflags[0]; + const unsigned long long int e525 = a124 & -9; + prop_hflags[0] = e525; reset_volatile_properties(nlocal, force); + const unsigned long long int a125 = prop_dflags[0]; + const unsigned long long int e526 = a125 & 2; + const bool e527 = e526 == 0; + if(e527) { + pairs::copy_to_device(position) + } + const unsigned long long int a126 = prop_dflags[0]; + const unsigned long long int e528 = a126 & 8; + const bool e529 = e528 == 0; + if(e529) { + pairs::copy_to_device(force) + } + const unsigned long long int a128 = prop_dflags[0]; + const unsigned long long int e530 = a128 | 10; + prop_dflags[0] = e530; + const unsigned long long int a130 = prop_hflags[0]; + const unsigned long long int e531 = a130 & -9; + prop_hflags[0] = e531; module_0(neighborlist_capacity, nlocal, neighborlists, numneighs, position, force); + const unsigned long long int a131 = prop_dflags[0]; + const unsigned long long int e532 = a131 & 2; + const bool e533 = e532 == 0; + if(e533) { + pairs::copy_to_device(position) + } + const unsigned long long int a132 = prop_dflags[0]; + const unsigned long long int e534 = a132 & 4; + const bool e535 = e534 == 0; + if(e535) { + pairs::copy_to_device(velocity) + } + const unsigned long long int a133 = prop_dflags[0]; + const unsigned long long int e536 = a133 & 1; + const bool e537 = e536 == 0; + if(e537) { + pairs::copy_to_device(mass) + } + const unsigned long long int a134 = prop_dflags[0]; + const unsigned long long int e538 = a134 & 8; + const bool e539 = e538 == 0; + if(e539) { + pairs::copy_to_device(force) + } + const unsigned long long int a136 = prop_dflags[0]; + const unsigned long long int e540 = a136 | 15; + prop_dflags[0] = e540; + const unsigned long long int a138 = prop_hflags[0]; + const unsigned long long int e541 = a138 & -7; + prop_hflags[0] = e541; module_1(nlocal, velocity, force, mass, position); const int e73 = i1 + 1; const int e402 = nlocal + npbc; diff --git a/src/pairs/code_gen/cgen.py b/src/pairs/code_gen/cgen.py index 2c188e7f8cdf4ea9cf661d264684aa7280cef562..8ca7b081b0ac19d888b17369dae2984e43728279 100644 --- a/src/pairs/code_gen/cgen.py +++ b/src/pairs/code_gen/cgen.py @@ -4,10 +4,9 @@ from pairs.ir.block import Block from pairs.ir.branches import Branch from pairs.ir.cast import Cast from pairs.ir.bin_op import BinOp, Decl, VectorAccess -from pairs.ir.data_types import Type_Int, Type_Float, Type_String, Type_Vector -from pairs.ir.device import DeviceCopy +from pairs.ir.device import CopyToDevice, CopyToHost from pairs.ir.functions import Call -from pairs.ir.layouts import Layout_AoS, Layout_SoA, Layout_Invalid +from pairs.ir.layouts import Layouts from pairs.ir.lit import Lit from pairs.ir.loops import For, Iter, ParticleFor, While from pairs.ir.math import Ceil, Sqrt @@ -16,6 +15,7 @@ from pairs.ir.module import ModuleCall from pairs.ir.properties import Property, PropertyAccess, PropertyList, RegisterProperty, UpdateProperty from pairs.ir.select import Select from pairs.ir.sizeof import Sizeof +from pairs.ir.types import Types from pairs.ir.utils import Print from pairs.ir.variables import Var, VarDecl, Deref from pairs.sim.timestep import Timestep @@ -25,13 +25,6 @@ from pairs.code_gen.printer import Printer class CGen: temp_id = 0 - def type2keyword(type_): - return ( - 'double' if type_ == Type_Float or type_ == Type_Vector - else 'int' if type_ == Type_Int - else 'bool' - ) - def __init__(self, output, debug=False): self.sim = None self.debug = debug @@ -68,44 +61,51 @@ class CGen: else: module_params = "" for var in module.read_only_variables(): - type_kw = CGen.type2keyword(var.type()) + type_kw = Types.ctype2keyword(var.type()) decl = f"{type_kw} {var.name()}" module_params += decl if len(module_params) <= 0 else f", {decl}" for var in module.write_variables(): - type_kw = CGen.type2keyword(var.type()) + type_kw = Types.ctype2keyword(var.type()) decl = f"{type_kw} *{var.name()}" module_params += decl if len(module_params) <= 0 else f", {decl}" for array in module.arrays(): - type_kw = CGen.type2keyword(array.type()) + type_kw = Types.ctype2keyword(array.type()) decl = f"{type_kw} *{array.name()}" module_params += decl if len(module_params) <= 0 else f", {decl}" for prop in module.properties(): - type_kw = CGen.type2keyword(prop.type()) + type_kw = Types.ctype2keyword(prop.type()) decl = f"{type_kw} *{prop.name()}" module_params += decl if len(module_params) <= 0 else f", {decl}" self.print(f"void {module.name}({module_params}) {{") - self.print.add_indent(4) if self.debug: + self.print.add_indent(4) self.generate_statement(Print(self.sim, module.name + " --- enter")) + self.print.add_indent(-4) self.generate_statement(module.block) if self.debug: + self.print.add_indent(4) self.generate_statement(Print(self.sim, module.name + " --- exit")) + self.print.add_indent(-4) - self.print.add_indent(-4) self.print("}") def generate_statement(self, ast_node, bypass_checking=False): if isinstance(ast_node, ArrayDecl): - tkw = CGen.type2keyword(ast_node.array.type()) + tkw = Types.ctype2keyword(ast_node.array.type()) size = self.generate_expression(BinOp.inline(ast_node.array.alloc_size())) - self.print(f"{tkw} {ast_node.array.name()}[{size}];") + if ast_node.array.is_static() and ast_node.array.init_value is not None: + v_str = str(ast_node.array.init_value) + init_string = v_str + (f", {v_str}" * (size - 1)) + self.print(f"{tkw} {ast_node.array.name()}[{size}] = {{{init_string}}};") + else: + self.print(f"{tkw} {ast_node.array.name()}[{size}];") if isinstance(ast_node, Assign): for assign_dest, assign_src in ast_node.assignments: @@ -136,7 +136,7 @@ class CGen: else: lhs = self.generate_expression(bin_op.lhs, bin_op.mem) rhs = self.generate_expression(bin_op.rhs) - tkw = CGen.type2keyword(bin_op.type()) + tkw = Types.ctype2keyword(bin_op.type()) self.print(f"const {tkw} e{bin_op.id()} = {lhs} {bin_op.operator()} {rhs};") ast_node.elem.generated = True @@ -152,7 +152,7 @@ class CGen: self.print(f"const double {acc_ref}_{i} = {prop_name}[{i_expr}];") else: - tkw = CGen.type2keyword(prop_access.type()) + tkw = Types.ctype2keyword(prop_access.type()) index_g = self.generate_expression(prop_access.index) self.print(f"const {tkw} {acc_ref} = {prop_name}[{index_g}];") @@ -173,9 +173,12 @@ class CGen: call = self.generate_expression(ast_node) self.print(f"{call};") - if isinstance(ast_node, DeviceCopy): + if isinstance(ast_node, CopyToDevice): self.print(f"pairs::copy_to_device({ast_node.prop.name()})") + if isinstance(ast_node, CopyToHost): + self.print(f"pairs::copy_to_host({ast_node.prop.name()})") + if isinstance(ast_node, For): iterator = self.generate_expression(ast_node.iterator) lower_range = None @@ -196,7 +199,7 @@ class CGen: if isinstance(ast_node, Malloc): - tkw = CGen.type2keyword(ast_node.array.type()) + tkw = Types.ctype2keyword(ast_node.array.type()) size = self.generate_expression(ast_node.size) array_name = ast_node.array.name() @@ -231,25 +234,25 @@ class CGen: self.print(f"fflush(stdout);") if isinstance(ast_node, Realloc): - tkw = CGen.type2keyword(ast_node.array.type()) + tkw = Types.ctype2keyword(ast_node.array.type()) size = self.generate_expression(ast_node.size) array_name = ast_node.array.name() self.print(f"{array_name} = ({tkw} *) realloc({array_name}, {size});") if isinstance(ast_node, RegisterProperty): p = ast_node.property() - ptype = "Prop_Integer" if p.type() == Type_Int else \ - "Prop_Float" if p.type() == Type_Float else \ - "Prop_Vector" if p.type() == Type_Vector else \ + ptype = "Prop_Integer" if p.type() == Types.Int32 else \ + "Prop_Float" if p.type() == Types.Double else \ + "Prop_Vector" if p.type() == Types.Vector else \ "Prop_Invalid" assert ptype != "Prop_Invalid", "Invalid property type!" - playout = "AoS" if p.layout() == Layout_AoS else \ - "SoA" if p.layout() == Layout_SoA else \ + playout = "AoS" if p.layout() == Layouts.AoS else \ + "SoA" if p.layout() == Layouts.SoA else \ "Invalid" - if p.type() != Type_Vector or p.layout() == Layout_Invalid: + if p.type() != Types.Vector or p.layout() == Layouts.Invalid: self.print(f"ps->addProperty(Property({p.id()}, \"{p.name()}\", {p.name()}, {ptype}));") else: sizes = ", ".join([str(self.generate_expression(size)) for size in ast_node.sizes()]) @@ -261,14 +264,14 @@ class CGen: if isinstance(ast_node, UpdateProperty): p = ast_node.property() - if p.type() != Type_Vector or p.layout() == Layout_Invalid: + if p.type() != Types.Vector or p.layout() == Layouts.Invalid: self.print(f"ps->updateProperty({p.id()}, {p.name()});") else: sizes = ", ".join([str(self.generate_expression(size)) for size in ast_node.sizes()]) self.print(f"ps->updateProperty({p.id()}, {p.name()}, {sizes});") if isinstance(ast_node, VarDecl): - tkw = CGen.type2keyword(ast_node.var.type()) + tkw = Types.ctype2keyword(ast_node.var.type()) self.print(f"{tkw} {ast_node.var.name()} = {ast_node.var.init_value()};") if isinstance(ast_node, While): @@ -289,7 +292,7 @@ class CGen: acc_ref = f"a{ast_node.id()}" if not ast_node.generated: - tkw = CGen.type2keyword(ast_node.type()) + tkw = Types.ctype2keyword(ast_node.type()) self.print(f"const {tkw} {acc_ref} = {array_name}[{acc_index}];") ast_node.generated = True @@ -300,7 +303,7 @@ class CGen: rhs = self.generate_expression(ast_node.rhs, index=index) if ast_node.inlined is True: - assert ast_node.type() != Type_Vector, "Vector operations cannot be inlined!" + assert ast_node.type() != Types.Vector, "Vector operations cannot be inlined!" return f"({lhs} {ast_node.operator()} {rhs})" # Some expressions can be defined on-the-fly during transformations, hence they do not have @@ -319,7 +322,7 @@ class CGen: return f"{ast_node.name()}({params})" if isinstance(ast_node, Cast): - tkw = CGen.type2keyword(ast_node.cast_type) + tkw = Types.ctype2keyword(ast_node.cast_type) expr = self.generate_expression(ast_node.expr) return f"({tkw})({expr})" @@ -338,7 +341,7 @@ class CGen: if isinstance(ast_node, Lit): assert mem is False, "Literal is not lvalue!" - if ast_node.type() == Type_String: + if ast_node.type() == Types.String: return f"\"{ast_node.value}\"" return ast_node.value @@ -374,7 +377,7 @@ class CGen: if isinstance(ast_node, Sizeof): assert mem is False, "Sizeof expression is not lvalue!" - tkw = CGen.type2keyword(ast_node.data_type) + tkw = Types.ctype2keyword(ast_node.data_type) return f"sizeof({tkw})" if isinstance(ast_node, Sqrt): diff --git a/src/pairs/coupling/parse_cpp.py b/src/pairs/coupling/parse_cpp.py index cafe9d306dd7ae8fa9cb01eee4dac658567e8ada..a1e9493c797d8375b1850d809ac2694c0e74de10 100644 --- a/src/pairs/coupling/parse_cpp.py +++ b/src/pairs/coupling/parse_cpp.py @@ -2,9 +2,9 @@ import clang.cindex from clang.cindex import CursorKind as kind from pairs.ast.block import Block from pairs.ast.branches import Branch -from pairs.ast.data_types import Type_Float, Type_Vector from pairs.ast.math import Sqrt from pairs.ast.select import Select +from pairs.ast.types import Types from pairs.sim.interaction import ParticleInteraction @@ -147,9 +147,9 @@ def dot(sim, params): def map_kernel_to_simulation(sim, node): - contactPoint = sim.add_var('contactPoint', Type_Vector) - contactNormal = sim.add_var('contactNormal', Type_Vector) - penetrationDepth = sim.add_var('penetrationDepth', Type_Float) + contactPoint = sim.add_var('contactPoint', Types.Vector) + contactNormal = sim.add_var('contactNormal', Types.Vector) + penetrationDepth = sim.add_var('penetrationDepth', Types.Double) self.init_block() pairs = ParticleInteraction(sim, 2) diff --git a/src/pairs/ir/arrays.py b/src/pairs/ir/arrays.py index 15601eff1416bd2e0e7f813b4c333607a76789cc..6573c12f513749ed0eeeb0d35fc4eb4ca9f47142 100644 --- a/src/pairs/ir/arrays.py +++ b/src/pairs/ir/arrays.py @@ -2,9 +2,8 @@ from functools import reduce from pairs.ir.assign import Assign from pairs.ir.ast_node import ASTNode from pairs.ir.bin_op import BinOp, ASTTerm -from pairs.ir.data_types import Type_Array -from pairs.ir.layouts import Layout_AoS, Layout_SoA -from pairs.ir.lit import as_lit_ast +from pairs.ir.layouts import Layouts +from pairs.ir.lit import Lit from pairs.ir.memory import Realloc from pairs.ir.variables import Var @@ -15,13 +14,13 @@ class Arrays: self.arrays = [] self.narrays = 0 - def add(self, a_name, a_sizes, a_type, a_layout=Layout_AoS): + def add(self, a_name, a_sizes, a_type, a_layout=Layouts.AoS): array = ArrayND(self.sim, a_name, a_sizes, a_type, a_layout) self.arrays.append(array) return array - def add_static(self, a_name, a_sizes, a_type, a_layout=Layout_AoS): - array = ArrayStatic(self.sim, a_name, a_sizes, a_type, a_layout) + def add_static(self, a_name, a_sizes, a_type, a_layout=Layouts.AoS, init_value=None): + array = ArrayStatic(self.sim, a_name, a_sizes, a_type, a_layout, init_value) self.arrays.append(array) return array @@ -37,12 +36,12 @@ class Arrays: class Array(ASTNode): - def __init__(self, sim, a_name, a_sizes, a_type, a_layout=Layout_AoS): + def __init__(self, sim, a_name, a_sizes, a_type, a_layout=Layouts.AoS): super().__init__(sim) self.arr_name = a_name self.arr_sizes = \ - [as_lit_ast(sim, a_sizes)] if not isinstance(a_sizes, list) \ - else [as_lit_ast(sim, s) for s in a_sizes] + [Lit.cvt(sim, a_sizes)] if not isinstance(a_sizes, list) \ + else [Lit.cvt(sim, s) for s in a_sizes] self.arr_type = a_type self.arr_layout = a_layout self.arr_ndims = len(self.arr_sizes) @@ -77,26 +76,24 @@ class Array(ASTNode): class ArrayStatic(Array): - def __init__(self, sim, a_name, a_sizes, a_type, a_layout=Layout_AoS): + def __init__(self, sim, a_name, a_sizes, a_type, a_layout=Layouts.AoS, init_value=None): super().__init__(sim, a_name, a_sizes, a_type, a_layout) + self.init_value = init_value self.static = True def __str__(self): - return (f"ArrayStatic<name: {self.arr_name}, " + - f"sizes: {self.arr_sizes}, " + - f"type: {self.arr_type}>") + return f"ArrayStatic<{self.arr_name}>" def realloc(self): raise Exception("Static array cannot be reallocated!") class ArrayND(Array): - def __init__(self, sim, a_name, a_sizes, a_type, a_layout=Layout_AoS): + def __init__(self, sim, a_name, a_sizes, a_type, a_layout=Layouts.AoS): super().__init__(sim, a_name, a_sizes, a_type, a_layout) def __str__(self): - return (f"ArrayND<name: {self.arr_name}, sizes: {self.arr_sizes}, " + - f"type: {self.arr_type}>") + return f"ArrayND<{self.arr_name}>" def realloc(self): return Realloc(self.sim, self, self.alloc_size()) @@ -113,18 +110,18 @@ class ArrayAccess(ASTTerm): super().__init__(sim) self.acc_id = ArrayAccess.new_id() self.array = array - self.indexes = [as_lit_ast(sim, index)] + self.indexes = [Lit.cvt(sim, index)] self.index = None self.inlined = False self.generated = False self.check_and_set_index() def __str__(self): - return f"ArrayAccess<array: {self.array}, indexes: {self.indexes}>" + return f"ArrayAccess<{self.array}, {self.indexes}>" def __getitem__(self, index): assert self.index is None, "Number of indexes higher than array dimension!" - self.indexes.append(as_lit_ast(self.sim, index)) + self.indexes.append(Lit.cvt(self.sim, index)) self.check_and_set_index() return self @@ -137,12 +134,12 @@ class ArrayAccess(ASTTerm): sizes = self.array.sizes() layout = self.array.layout() - if layout == Layout_AoS: + if layout == Layouts.AoS: for s in range(0, len(sizes)): self.index = (self.indexes[s] if self.index is None else self.index * sizes[s] + self.indexes[s]) - elif layout == Layout_SoA: + elif layout == Layouts.SoA: for s in reversed(range(0, len(sizes))): self.index = (self.indexes[s] if self.index is None else self.index * sizes[s] + self.indexes[s]) @@ -150,7 +147,7 @@ class ArrayAccess(ASTTerm): else: raise Exception("Invalid data layout!") - self.index = as_lit_ast(self.sim, self.index) + self.index = Lit.cvt(self.sim, self.index) def set(self, other): return self.sim.add_statement(Assign(self.sim, self, other)) @@ -163,7 +160,7 @@ class ArrayAccess(ASTTerm): def type(self): return self.array.type() - # return self.array.type() if self.index is None else Type_Array + # return self.array.type() if self.index is None else Types.Array def children(self): if self.index is not None: diff --git a/src/pairs/ir/assign.py b/src/pairs/ir/assign.py index 97af6ea5045ff50c9c8bec28e2f61e84e53de207..424e76caf1604a6393f48c4766f9431312b0f3a3 100644 --- a/src/pairs/ir/assign.py +++ b/src/pairs/ir/assign.py @@ -1,7 +1,7 @@ from functools import reduce from pairs.ir.ast_node import ASTNode -from pairs.ir.data_types import Type_Vector -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit +from pairs.ir.types import Types from pairs.ir.vector_expr import VectorExpression @@ -9,13 +9,13 @@ class Assign(ASTNode): def __init__(self, sim, dest, src): super().__init__(sim) self.type = dest.type() - src = as_lit_ast(sim, src) + src = Lit.cvt(sim, src) - if dest.type() == Type_Vector: + if dest.type() == Types.Vector: self.assignments = [] for i in range(0, sim.ndims()): - dim_src = src if not isinstance(src, VectorExpression) or src.type() != Type_Vector else src[i] + dim_src = src if not isinstance(src, VectorExpression) or src.type() != Types.Vector else src[i] self.assignments.append((dest[i], dim_src)) else: self.assignments = [(dest, src)] diff --git a/src/pairs/ir/ast_node.py b/src/pairs/ir/ast_node.py index 71ce1c1a353f0f0aa6df78e2d8a511c674d6eb87..b059df46c90723395087e64a1a1d830ccbc662ab 100644 --- a/src/pairs/ir/ast_node.py +++ b/src/pairs/ir/ast_node.py @@ -1,4 +1,4 @@ -from pairs.ir.data_types import Type_Invalid +from pairs.ir.types import Types class ASTNode: @@ -10,7 +10,7 @@ class ASTNode: return "ASTNode<>" def type(self): - return Type_Invalid + return Types.Invalid def children(self): return [] diff --git a/src/pairs/ir/bin_op.py b/src/pairs/ir/bin_op.py index 7693cc116c4e4acb5ea1c20c3d9e00b058a9dd5d..db6088bc06d4aeb510fe269bf84d53e4176eea1b 100644 --- a/src/pairs/ir/bin_op.py +++ b/src/pairs/ir/bin_op.py @@ -1,7 +1,7 @@ from pairs.ir.ast_node import ASTNode from pairs.ir.assign import Assign -from pairs.ir.data_types import Type_Float, Type_Bool, Type_Vector -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit +from pairs.ir.types import Types from pairs.ir.vector_expr import VectorExpression @@ -13,7 +13,7 @@ class Decl(ASTNode): sim.add_statement(self) def __str__(self): - return f"Decl<elem: self.elem>" + return f"Decl<self.elem>" def children(self): return [self.elem] @@ -35,8 +35,8 @@ class BinOp(VectorExpression): def __init__(self, sim, lhs, rhs, op, mem=False): super().__init__(sim) self.bin_op_id = BinOp.new_id() - self.lhs = as_lit_ast(sim, lhs) - self.rhs = as_lit_ast(sim, rhs) + self.lhs = Lit.cvt(sim, lhs) + self.rhs = Lit.cvt(sim, rhs) self.op = op self.mem = mem self.inlined = False @@ -47,15 +47,15 @@ class BinOp(VectorExpression): def reassign(self, lhs, rhs, op): assert self.generated is False, "Error on reassign: BinOp {} already generated!".format(self.bin_op_id) - self.lhs = as_lit_ast(self.sim, lhs) - self.rhs = as_lit_ast(self.sim, rhs) + self.lhs = Lit.cvt(self.sim, lhs) + self.rhs = Lit.cvt(self.sim, rhs) self.op = op self.bin_op_type = BinOp.infer_type(self.lhs, self.rhs, self.op) def __str__(self): a = self.lhs.id() if isinstance(self.lhs, BinOp) else self.lhs b = self.rhs.id() if isinstance(self.rhs, BinOp) else self.rhs - return f"BinOp<a: {a}, b: {b}, op: {self.op}>" + return f"BinOp<{a} {self.op} {b}>" def match(self, bin_op): return self.lhs == bin_op.lhs and self.rhs == bin_op.rhs and self.op == bin_op.operator() @@ -86,22 +86,32 @@ class BinOp(VectorExpression): rhs_type = rhs.type() if op in ['>', '<', '>=', '<=', '==', '!=']: - return Type_Bool + return Types.Boolean if op == '[]': - if lhs_type == Type_Vector: - return Type_Float + if lhs_type == Types.Vector: + return Types.Double return lhs_type if lhs_type == rhs_type: return lhs_type - if lhs_type == Type_Vector or rhs_type == Type_Vector: - return Type_Vector + if Types.is_integer(lhs_type) or Types.is_integer(rhs_type): + if isinstance(lhs, Lit) or Lit.is_literal(lhs): + return rhs_type - if lhs_type == Type_Float or rhs_type == Type_Float: - return Type_Float + if isinstance(rhs, Lit) or Lit.is_literal(rhs): + return lhs_type + + # TODO: Are more checkings required here to generate proper integer data type? + return lhs_type + + if lhs_type == Types.Vector or rhs_type == Types.Vector: + return Types.Vector + + if Types.is_real(lhs_type) or Types.is_real(rhs_type): + return Types.Double return None @@ -136,7 +146,7 @@ class BinOp(VectorExpression): def __getitem__(self, index): super().__getitem__(index) - return VectorAccess(self.sim, self, as_lit_ast(self.sim, index)) + return VectorAccess(self.sim, self, Lit.cvt(self.sim, index)) def __add__(self, other): return BinOp(self.sim, self, other, '+') @@ -224,6 +234,18 @@ class ASTTerm(ASTNode): def __ge__(self, other): return BinOp(self.sim, self, other, '>=') + def __and__(self, other): + return BinOp(self.sim, self, other, '&') + + def __or__(self, other): + return BinOp(self.sim, self, other, '|') + + def __xor__(self, other): + return BinOp(self.sim, self, other, '^') + + def __invert__(self): + return BinOp(self.sim, self, None, '~') + def and_op(self, other): return BinOp(self.sim, self, other, '&&') @@ -250,7 +272,7 @@ class VectorAccess(ASTTerm): self.index = index def type(self): - return Type_Float + return Types.Double def set(self, other): return self.sim.add_statement(Assign(self.sim, self, other)) diff --git a/src/pairs/ir/branches.py b/src/pairs/ir/branches.py index aa41913921cc90fd5122b0dbffdd4d7cd7c2b82f..6ca19e600cbf485e195793db89ce40a99760dfc7 100644 --- a/src/pairs/ir/branches.py +++ b/src/pairs/ir/branches.py @@ -1,12 +1,12 @@ from pairs.ir.ast_node import ASTNode from pairs.ir.block import Block -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit class Branch(ASTNode): def __init__(self, sim, cond, one_way=False, blk_if=None, blk_else=None): self.sim = sim - self.cond = as_lit_ast(sim, cond) + self.cond = Lit.cvt(sim, cond) self.switch = True self.block_if = Block(sim, []) if blk_if is None else blk_if self.block_else = None if one_way else Block(sim, []) if blk_else is None else blk_else diff --git a/src/pairs/ir/cast.py b/src/pairs/ir/cast.py index fe6674ae8d07ef55b69ab6a9210b4d9ebde18978..d177aa06d621ca998bac6bf18c268d712de70e0f 100644 --- a/src/pairs/ir/cast.py +++ b/src/pairs/ir/cast.py @@ -1,5 +1,5 @@ from pairs.ir.bin_op import ASTTerm -from pairs.ir.data_types import Type_Int, Type_Float +from pairs.ir.types import Types class Cast(ASTTerm): @@ -9,13 +9,13 @@ class Cast(ASTTerm): self.cast_type = cast_type def __str__(self): - return f"Cast<expr: {self.expr}, cast_type: {self.cast_type}>" + return f"Cast<{self.expr}, {self.cast_type}>" def int(sim, expr): - return Cast(sim, expr, Type_Int) + return Cast(sim, expr, Types.Int32) - def float(sim, expr): - return Cast(sim, expr, Type_Float) + def double(sim, expr): + return Cast(sim, expr, Types.Double) def type(self): return self.cast_type diff --git a/src/pairs/ir/data_types.py b/src/pairs/ir/data_types.py deleted file mode 100644 index e3dc0ad6eef799b5d7165c86b032aeaad83eb8a8..0000000000000000000000000000000000000000 --- a/src/pairs/ir/data_types.py +++ /dev/null @@ -1,7 +0,0 @@ -Type_Invalid = -1 -Type_Int = 0 -Type_Float = 1 -Type_Bool = 2 -Type_String = 3 -Type_Vector = 4 -Type_Array = 5 diff --git a/src/pairs/ir/device.py b/src/pairs/ir/device.py index b9c8903b5ffee7d0bcb5ffe4a207d5d2a67445d2..b583bcd9891504e81a286ccb5ba8b0c2ce9d2507 100644 --- a/src/pairs/ir/device.py +++ b/src/pairs/ir/device.py @@ -1,7 +1,16 @@ from pairs.ir.ast_node import ASTNode -class DeviceCopy(ASTNode): +class CopyToDevice(ASTNode): + def __init__(self, sim, prop): + super().__init__(sim) + self.prop = prop + + def children(self): + return [self.prop] + + +class CopyToHost(ASTNode): def __init__(self, sim, prop): super().__init__(sim) self.prop = prop diff --git a/src/pairs/ir/functions.py b/src/pairs/ir/functions.py index 0d30f494ef70bc6e6f949481c41a9558d40e5d21..2b67a506f0d8dd82cbd73f8321ba6c64f06be150 100644 --- a/src/pairs/ir/functions.py +++ b/src/pairs/ir/functions.py @@ -1,13 +1,13 @@ from pairs.ir.bin_op import ASTTerm -from pairs.ir.data_types import Type_Int, Type_Invalid -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit +from pairs.ir.types import Types class Call(ASTTerm): def __init__(self, sim, func_name, params, return_type): super().__init__(sim) self.func_name = func_name - self.params = [as_lit_ast(sim, p) for p in params] + self.params = [Lit.cvt(sim, p) for p in params] self.return_type = return_type def name(self): @@ -25,10 +25,10 @@ class Call(ASTTerm): class Call_Int(Call): def __init__(self, sim, func_name, parameters): - super().__init__(sim, func_name, parameters, Type_Int) + super().__init__(sim, func_name, parameters, Types.Int32) class Call_Void(Call): def __init__(self, sim, func_name, parameters): - super().__init__(sim, func_name, parameters, Type_Invalid) + super().__init__(sim, func_name, parameters, Types.Invalid) sim.add_statement(self) diff --git a/src/pairs/ir/layouts.py b/src/pairs/ir/layouts.py index 43f9a3c839fe6875f2c1195b07fe85807f07d455..87a0b45c1694baa4637bed5c84ad01be1cccf746 100644 --- a/src/pairs/ir/layouts.py +++ b/src/pairs/ir/layouts.py @@ -1,3 +1,4 @@ -Layout_Invalid = -1 -Layout_AoS = 0 -Layout_SoA = 1 +class Layouts: + Invalid = -1 + AoS = 0 + SoA = 1 diff --git a/src/pairs/ir/lit.py b/src/pairs/ir/lit.py index ff738b5a1dc0d8fba8069cca8f48097a94fd7cf3..ce829b3f4a1346ace8a3b33f09b73cfb0a88212a 100644 --- a/src/pairs/ir/lit.py +++ b/src/pairs/ir/lit.py @@ -1,37 +1,35 @@ from pairs.ir.ast_node import ASTNode -from pairs.ir.data_types import Type_Invalid, Type_Int, Type_Float, Type_Bool, Type_String, Type_Vector +from pairs.ir.types import Types -def is_literal(a): - return isinstance(a, (int, float, bool, str, list)) - - -def as_lit_ast(sim, a): - return Lit(sim, a) if is_literal(a) else a +class Lit(ASTNode): + def is_literal(a): + return isinstance(a, (int, float, bool, str, list)) + def cvt(sim, a): + return Lit(sim, a) if Lit.is_literal(a) else a -class Lit(ASTNode): def __init__(self, sim, value): super().__init__(sim) self.value = value - self.lit_type = Type_Invalid + self.lit_type = Types.Invalid if isinstance(value, int): - self.lit_type = Type_Int + self.lit_type = Types.Int32 if isinstance(value, float): - self.lit_type = Type_Float + self.lit_type = Types.Double if isinstance(value, bool): - self.lit_type = Type_Bool + self.lit_type = Types.Boolean if isinstance(value, str): - self.lit_type = Type_String + self.lit_type = Types.String if isinstance(value, list): - self.lit_type = Type_Vector + self.lit_type = Types.Vector - assert self.lit_type != Type_Invalid, "Invalid literal type!" + assert self.lit_type != Types.Invalid, "Invalid literal type!" def __str__(self): return f"Lit<{self.value}>" diff --git a/src/pairs/ir/loops.py b/src/pairs/ir/loops.py index 1e2253fe24c5e52b7b92bb49d94a46b976351ffe..de667de713e18005c93bd347f6d5087b76fa1da2 100644 --- a/src/pairs/ir/loops.py +++ b/src/pairs/ir/loops.py @@ -2,8 +2,8 @@ from pairs.ir.ast_node import ASTNode from pairs.ir.bin_op import BinOp, ASTTerm from pairs.ir.block import Block from pairs.ir.branches import Filter -from pairs.ir.data_types import Type_Int -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit +from pairs.ir.types import Types class Iter(ASTTerm): @@ -25,7 +25,7 @@ class Iter(ASTTerm): return f"i{self.iter_id}" def type(self): - return Type_Int + return Types.Int32 def __eq__(self, other): if isinstance(other, Iter): @@ -44,12 +44,12 @@ class For(ASTNode): def __init__(self, sim, range_min, range_max, block=None): super().__init__(sim) self.iterator = Iter(sim, self) - self.min = as_lit_ast(sim, range_min) - self.max = as_lit_ast(sim, range_max) + self.min = Lit.cvt(sim, range_min) + self.max = Lit.cvt(sim, range_max) self.block = Block(sim, []) if block is None else block def __str__(self): - return f"For<min: {self.min}, max: {self.max}>" + return f"For<{self.iterator}, {self.min} ... {self.max}>" def iter(self): return self.iterator @@ -73,7 +73,7 @@ class ParticleFor(For): self.local_only = local_only def __str__(self): - return f"ParticleFor<>" + return f"ParticleFor<self.iterator>" def children(self): return [self.block, self.sim.nlocal] + ([] if self.local_only else [self.sim.pbc.npbc]) diff --git a/src/pairs/ir/math.py b/src/pairs/ir/math.py index 09e41713a16ff157841a3d607ecfc65d4093a676..3f74aea6491b5ae278d51e7df35d9607dae3881a 100644 --- a/src/pairs/ir/math.py +++ b/src/pairs/ir/math.py @@ -1,5 +1,5 @@ from pairs.ir.bin_op import ASTTerm -from pairs.ir.data_types import Type_Int, Type_Float +from pairs.ir.types import Types class Sqrt(ASTTerm): @@ -8,7 +8,7 @@ class Sqrt(ASTTerm): self.expr = expr def __str__(self): - return f"Sqrt<expr: {self.expr}>" + return f"Sqrt<{self.expr}>" def type(self): return self.expr.type() @@ -19,15 +19,15 @@ class Sqrt(ASTTerm): class Ceil(ASTTerm): def __init__(self, sim, expr): - assert expr.type() == Type_Float, "Expression must be of floating-point type!" + assert Types.is_real(expr.type()), "Expression must be of real type!" super().__init__(sim) self.expr = expr def __str__(self): - return f"Ceil<expr: {self.expr}>" + return f"Ceil<{self.expr}>" def type(self): - return Type_Int + return Types.Int32 def children(self): return [self.expr] diff --git a/src/pairs/ir/properties.py b/src/pairs/ir/properties.py index 1aab83adb7cda7bc5a8e31b57d1280663b09ca40..5ee78f4c656fed4dc0278f43a98f8ab6c2cab20b 100644 --- a/src/pairs/ir/properties.py +++ b/src/pairs/ir/properties.py @@ -1,9 +1,9 @@ from pairs.ir.ast_node import ASTNode from pairs.ir.assign import Assign from pairs.ir.bin_op import BinOp, Decl, ASTTerm, VectorAccess -from pairs.ir.data_types import Type_Vector -from pairs.ir.layouts import Layout_AoS -from pairs.ir.lit import as_lit_ast +from pairs.ir.layouts import Layouts +from pairs.ir.lit import Lit +from pairs.ir.types import Types from pairs.ir.vector_expr import VectorExpression @@ -13,9 +13,8 @@ class Properties: self.props = [] self.capacities = [] self.defs = {} - self.nprops = 0 - def add(self, p_name, p_type, p_value, p_volatile, p_layout=Layout_AoS): + def add(self, p_name, p_type, p_value, p_volatile, p_layout=Layouts.AoS): p = Property(self.sim, p_name, p_type, p_value, p_volatile, p_layout) self.props.append(p) self.defs[p_name] = p_value @@ -50,7 +49,7 @@ class Properties: class Property(ASTNode): last_prop_id = 0 - def __init__(self, sim, name, dtype, default, volatile, layout=Layout_AoS): + def __init__(self, sim, name, dtype, default, volatile, layout=Layouts.AoS): super().__init__(sim) self.prop_id = Property.last_prop_id self.prop_name = name @@ -79,10 +78,10 @@ class Property(ASTNode): return self.default_value def ndims(self): - return 1 if self.prop_type != Type_Vector else 2 + return 1 if self.prop_type != Types.Vector else 2 def sizes(self): - return [self.sim.particle_capacity] if self.prop_type != Type_Vector else [self.sim.ndims(), self.sim.particle_capacity] + return [self.sim.particle_capacity] if self.prop_type != Types.Vector else [self.sim.ndims(), self.sim.particle_capacity] def __getitem__(self, expr): return PropertyAccess(self.sim, self, expr) @@ -99,20 +98,20 @@ class PropertyAccess(ASTTerm, VectorExpression): super().__init__(sim) self.acc_id = PropertyAccess.new_id() self.prop = prop - self.index = as_lit_ast(sim, index) + self.index = Lit.cvt(sim, index) self.inlined = False self.generated = False self.terminals = set() self.decl = Decl(sim, self) def __str__(self): - return f"PropertyAccess<prop: {self.prop}, index: {self.index}>" + return f"PropertyAccess<{self.prop}, {self.index}>" def vector_index(self, v_index): sizes = self.prop.sizes() layout = self.prop.layout() - index = self.index * sizes[0] + v_index if layout == Layout_AoS else \ - v_index * sizes[1] + self.index if layout == Layout_SoA else \ + index = self.index * sizes[0] + v_index if layout == Layouts.AoS else \ + v_index * sizes[1] + self.index if layout == Layouts.SoA else \ None assert index is not None, "Invalid data layout" @@ -151,7 +150,7 @@ class PropertyAccess(ASTTerm, VectorExpression): def __getitem__(self, index): super().__getitem__(index) - return VectorAccess(self.sim, self, as_lit_ast(self.sim, index)) + return VectorAccess(self.sim, self, Lit.cvt(self.sim, index)) class PropertyList(ASTNode): @@ -176,7 +175,7 @@ class RegisterProperty(ASTNode): def __init__(self, sim, prop, sizes): super().__init__(sim) self.prop = prop - self.sizes_list = [as_lit_ast(sim, s) for s in sizes] + self.sizes_list = [Lit.cvt(sim, s) for s in sizes] self.sim.add_statement(self) def property(self): @@ -193,7 +192,7 @@ class UpdateProperty(ASTNode): def __init__(self, sim, prop, sizes): super().__init__(sim) self.prop = prop - self.sizes_list = [as_lit_ast(sim, s) for s in sizes] + self.sizes_list = [Lit.cvt(sim, s) for s in sizes] self.sim.add_statement(self) def property(self): diff --git a/src/pairs/ir/select.py b/src/pairs/ir/select.py index 8e5e3aebbb22f02eae1adaf68ac4d4dba4a09222..c9a02604c1841bd266612fc5ecf15cd1f7a595cd 100644 --- a/src/pairs/ir/select.py +++ b/src/pairs/ir/select.py @@ -1,14 +1,14 @@ from pairs.ir.ast_node import ASTNode from pairs.ir.bin_op import BinOp -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit class Select(ASTNode): def __init__(self, sim, cond, expr_if, expr_else): super().__init__(sim) - self.cond = as_lit_ast(sim, cond) - self.expr_if = BinOp.inline(as_lit_ast(sim, expr_if)) - self.expr_else = BinOp.inline(as_lit_ast(sim, expr_else)) + self.cond = Lit.cvt(sim, cond) + self.expr_if = BinOp.inline(Lit.cvt(sim, expr_if)) + self.expr_else = BinOp.inline(Lit.cvt(sim, expr_else)) def children(self): return [self.cond, self.expr_if, self.expr_else] diff --git a/src/pairs/ir/sizeof.py b/src/pairs/ir/sizeof.py index 407231390893e624b09e88623f0da9617bac689c..6929810f786bc1ad3d04ff31b7abf4474ad087c6 100644 --- a/src/pairs/ir/sizeof.py +++ b/src/pairs/ir/sizeof.py @@ -1,5 +1,5 @@ from pairs.ir.bin_op import ASTTerm -from pairs.ir.data_types import Type_Int +from pairs.ir.types import Types class Sizeof(ASTTerm): @@ -8,4 +8,4 @@ class Sizeof(ASTTerm): self.data_type = data_type def type(self): - return Type_Int + return Types.Int32 diff --git a/src/pairs/ir/symbols.py b/src/pairs/ir/symbols.py index 08ee01d0ba7470dc090d3d056261ee2f0e77d031..556d073fb8d871a3ad024fda7e62b08b1b8a3d38 100644 --- a/src/pairs/ir/symbols.py +++ b/src/pairs/ir/symbols.py @@ -10,7 +10,7 @@ class Symbol(ASTTerm): self.assign_to = None def __str__(self): - return f"Symbol<type: {self.var_type}>" + return f"Symbol<{self.var_type}>" def assign(self, node): self.assign_to = node diff --git a/src/pairs/ir/types.py b/src/pairs/ir/types.py new file mode 100644 index 0000000000000000000000000000000000000000..f86a0579682adc7dc3925e7390715fd92c412ba7 --- /dev/null +++ b/src/pairs/ir/types.py @@ -0,0 +1,27 @@ +class Types: + Invalid = -1 + Int32 = 0 + Int64 = 1 + UInt64 = 2 + Float = 3 + Double = 4 + Boolean = 5 + String = 6 + Vector = 7 + Array = 8 + + def ctype2keyword(t): + return ( + 'double' if t == Types.Double or t == Types.Vector + else 'float' if t == Types.Float + else 'int' if t == Types.Int32 + else 'long long int' if t == Types.Int64 + else 'unsigned long long int' if t == Types.UInt64 + else 'bool' + ) + + def is_integer(t): + return t == Types.Int32 or t == Types.Int64 or t == Types.UInt64 + + def is_real(t): + return t == Types.Float or t == Types.Double diff --git a/src/pairs/ir/variables.py b/src/pairs/ir/variables.py index 2990e91a7fbf435a2f98ee51b7294e70d3eb1f9d..d35453540dc18a936f3ebfb8ba682936564d8882 100644 --- a/src/pairs/ir/variables.py +++ b/src/pairs/ir/variables.py @@ -35,7 +35,7 @@ class Var(ASTTerm): self.var_bonded_arrays = [] def __str__(self): - return f"Var<name: {self.var_name}, type: {self.var_type}>" + return f"Var<{self.var_name}>" def set(self, other): return self.sim.add_statement(Assign(self.sim, self, other)) @@ -75,7 +75,7 @@ class Deref(ASTTerm): self._var = var def __str__(self): - return f"Deref<var: {self.var.name()}>" + return f"Deref<{self.var.name()}>" @property def var(self): diff --git a/src/pairs/ir/vector_expr.py b/src/pairs/ir/vector_expr.py index 706a07d75c1cae451d78ea7cae6a6b4536569e97..e9627da734682cbb70550b3f14fbff5d5c155259 100644 --- a/src/pairs/ir/vector_expr.py +++ b/src/pairs/ir/vector_expr.py @@ -1,6 +1,6 @@ from pairs.ir.ast_node import ASTNode -from pairs.ir.data_types import Type_Vector from pairs.ir.lit import Lit +from pairs.ir.types import Types class VectorExpression(ASTNode): @@ -34,7 +34,7 @@ class VectorExpression(ASTNode): p.propagate_vector_index(index) def is_vector_kind(self): - return self.type() == Type_Vector + return self.type() == Types.Vector # Default is to propagate through children, but this can be overridden def propagate_through(self): @@ -44,6 +44,6 @@ class VectorExpression(ASTNode): return self.vector_expressions() def __getitem__(self, index): - assert self.type() == Type_Vector, "Cannot use operator [] on specified type!" + assert self.type() == Types.Vector, "Cannot use operator [] on specified type!" self.propagate_vector_index(index) return self diff --git a/src/pairs/sim/cell_lists.py b/src/pairs/sim/cell_lists.py index 0ba7481e675fc21e9894443219e29284f20a3cda..b5e5d180667261d7a389e30491c9055646e73ca2 100644 --- a/src/pairs/sim/cell_lists.py +++ b/src/pairs/sim/cell_lists.py @@ -4,12 +4,11 @@ from pairs.ir.bin_op import BinOp from pairs.ir.block import pairs_device_block from pairs.ir.branches import Branch, Filter from pairs.ir.cast import Cast -from pairs.ir.data_types import Type_Int -from pairs.ir.math import Ceil from pairs.ir.loops import For, ParticleFor +from pairs.ir.math import Ceil +from pairs.ir.types import Types from pairs.ir.utils import Print from pairs.sim.lowerable import Lowerable -from pairs.sim.resize import Resize class CellLists: @@ -21,15 +20,15 @@ class CellLists: self.nneighbor_cells = [math.ceil(cutoff_radius / self.spacing[d]) for d in range(sim.ndims())] self.nstencil_max = reduce((lambda x, y: x * y), [self.nneighbor_cells[d] * 2 + 1 for d in range(sim.ndims())]) # Data introduced in the simulation - self.nstencil = self.sim.add_var('nstencil', Type_Int) - self.ncells = self.sim.add_var('ncells', Type_Int, 1) - self.ncells_capacity = self.sim.add_var('ncells_capacity', Type_Int, 100) - self.cell_capacity = self.sim.add_var('cell_capacity', Type_Int, 20) - self.dim_ncells = self.sim.add_static_array('dim_cells', self.sim.ndims(), Type_Int) - self.cell_particles = self.sim.add_array('cell_particles', [self.ncells_capacity, self.cell_capacity], Type_Int) - self.cell_sizes = self.sim.add_array('cell_sizes', self.ncells_capacity, Type_Int) - self.stencil = self.sim.add_array('stencil', self.nstencil_max, Type_Int) - self.particle_cell = self.sim.add_array('particle_cell', self.sim.particle_capacity, Type_Int) + self.nstencil = self.sim.add_var('nstencil', Types.Int32) + self.ncells = self.sim.add_var('ncells', Types.Int32, 1) + self.ncells_capacity = self.sim.add_var('ncells_capacity', Types.Int32, 100) + self.cell_capacity = self.sim.add_var('cell_capacity', Types.Int32, 20) + self.dim_ncells = self.sim.add_static_array('dim_cells', self.sim.ndims(), Types.Int32) + self.cell_particles = self.sim.add_array('cell_particles', [self.ncells_capacity, self.cell_capacity], Types.Int32) + self.cell_sizes = self.sim.add_array('cell_sizes', self.ncells_capacity, Types.Int32) + self.stencil = self.sim.add_array('stencil', self.nstencil_max, Types.Int32) + self.particle_cell = self.sim.add_array('particle_cell', self.sim.particle_capacity, Types.Int32) class CellListsStencilBuild(Lowerable): diff --git a/src/pairs/sim/grid.py b/src/pairs/sim/grid.py index 6d71d2f3b9026bdb53de25fe2b40b2aaf9f29fa0..54c8e41c6aeb53a3b686c88bf9e6305490b133a3 100644 --- a/src/pairs/sim/grid.py +++ b/src/pairs/sim/grid.py @@ -1,4 +1,4 @@ -from pairs.ir.data_types import Type_Float +from pairs.ir.types import Types class Grid: @@ -56,6 +56,6 @@ class MutableGrid(Grid): def __init__(self, sim, ndims): self.id = MutableGrid.last_id prefix = f"grid{self.id}_" - config = [[sim.add_var(f"{prefix}d{d}_min", Type_Float), sim.add_var(f"{prefix}d{d}_max", Type_Float)] for d in range(ndims)] + config = [[sim.add_var(f"{prefix}d{d}_min", Types.Double), sim.add_var(f"{prefix}d{d}_max", Types.Double)] for d in range(ndims)] super().__init__(sim, config) MutableGrid.last_id += 1 diff --git a/src/pairs/sim/interaction.py b/src/pairs/sim/interaction.py index 074f416692e97121bf9d9d2bfef62108b80c3765..123d701bbc69ece69d12aabae92a674fdcd98376 100644 --- a/src/pairs/sim/interaction.py +++ b/src/pairs/sim/interaction.py @@ -1,11 +1,10 @@ from pairs.ir.bin_op import BinOp from pairs.ir.block import Block, pairs_block from pairs.ir.branches import Branch, Filter -from pairs.ir.data_types import Type_Int, Type_Float, Type_Vector from pairs.ir.loops import For, ParticleFor +from pairs.ir.types import Types from pairs.ir.utils import Print from pairs.sim.lowerable import Lowerable -from pairs.sim.resize import Resize class NeighborFor(): @@ -16,7 +15,7 @@ class NeighborFor(): self.neighbor_lists = neighbor_lists def __str__(self): - return f"NeighborFor<particle: {self.particle}>" + return f"NeighborFor<{self.particle}>" def __iter__(self): if self.neighbor_lists is None: @@ -40,10 +39,10 @@ class ParticleInteraction(Lowerable): self.nbody = nbody self.cutoff_radius = cutoff_radius self.bypass_neighbor_lists = bypass_neighbor_lists - self.i = sim.add_symbol(Type_Int) - self.j = sim.add_symbol(Type_Int) - self.dp = sim.add_symbol(Type_Vector) - self.rsq = sim.add_symbol(Type_Float) + self.i = sim.add_symbol(Types.Int32) + self.j = sim.add_symbol(Types.Int32) + self.dp = sim.add_symbol(Types.Vector) + self.rsq = sim.add_symbol(Types.Double) self.block = Block(sim, []) if block is None else block def delta(self): diff --git a/src/pairs/sim/lattice.py b/src/pairs/sim/lattice.py index e1faa010edbfcf0ff8f50ffd8e6eb6e5517a5db5..bc3e657ba5762f9c93ed9c14ae1401bf750ab2c0 100644 --- a/src/pairs/sim/lattice.py +++ b/src/pairs/sim/lattice.py @@ -1,6 +1,6 @@ from pairs.ir.block import pairs_block -from pairs.ir.data_types import Type_Vector from pairs.ir.loops import For +from pairs.ir.types import Types from pairs.sim.lowerable import Lowerable @@ -36,7 +36,7 @@ class ParticleLattice(Lowerable): for prop in [p for p in self.sim.properties.all() if p.volatile is False and p.name() != self.positions.name()]: - if prop.type() == Type_Vector: + if prop.type() == Types.Vector: for d_ in range(0, self.sim.ndims()): prop[index][d_].set(prop.default()[d_]) diff --git a/src/pairs/sim/neighbor_lists.py b/src/pairs/sim/neighbor_lists.py index 54bcc2e0fbf6a0c6a8c00c8a838a3f065da1e4ac..eda0018e18c104e4d374d1a5b3b2f23fff5af94f 100644 --- a/src/pairs/sim/neighbor_lists.py +++ b/src/pairs/sim/neighbor_lists.py @@ -1,20 +1,19 @@ from pairs.ir.block import pairs_device_block from pairs.ir.branches import Branch, Filter -from pairs.ir.data_types import Type_Int from pairs.ir.loops import ParticleFor +from pairs.ir.types import Types from pairs.ir.utils import Print from pairs.sim.interaction import ParticleInteraction from pairs.sim.lowerable import Lowerable -from pairs.sim.resize import Resize class NeighborLists: def __init__(self, cell_lists): self.sim = cell_lists.sim self.cell_lists = cell_lists - self.capacity = self.sim.add_var('neighborlist_capacity', Type_Int, 32) - self.neighborlists = self.sim.add_array('neighborlists', [self.sim.particle_capacity, self.capacity], Type_Int) - self.numneighs = self.sim.add_array('numneighs', self.sim.particle_capacity, Type_Int) + self.capacity = self.sim.add_var('neighborlist_capacity', Types.Int32, 32) + self.neighborlists = self.sim.add_array('neighborlists', [self.sim.particle_capacity, self.capacity], Types.Int32) + self.numneighs = self.sim.add_array('numneighs', self.sim.particle_capacity, Types.Int32) class NeighborListsBuild(Lowerable): diff --git a/src/pairs/sim/pbc.py b/src/pairs/sim/pbc.py index f91dd136a9a0fc7f33b24f7b79cfdf7113d60e81..f1b457123743d5cadca8a940e763a07f4cedbbe5 100644 --- a/src/pairs/sim/pbc.py +++ b/src/pairs/sim/pbc.py @@ -1,11 +1,10 @@ from pairs.ir.block import pairs_device_block from pairs.ir.branches import Branch, Filter -from pairs.ir.data_types import Type_Int from pairs.ir.loops import For, ParticleFor from pairs.ir.utils import Print from pairs.ir.select import Select +from pairs.ir.types import Types from pairs.sim.lowerable import Lowerable -from pairs.sim.resize import Resize class PBC: @@ -14,10 +13,10 @@ class PBC: self.grid = grid self.cutneigh = cutneigh self.pbc_flags = pbc_flags - self.npbc = sim.add_var('npbc', Type_Int) - self.pbc_capacity = sim.add_var('pbc_capacity', Type_Int, 100) - self.pbc_map = sim.add_array('pbc_map', [self.pbc_capacity], Type_Int) - self.pbc_mult = sim.add_array('pbc_mult', [self.pbc_capacity, sim.ndims()], Type_Int) + self.npbc = sim.add_var('npbc', Types.Int32) + self.pbc_capacity = sim.add_var('pbc_capacity', Types.Int32, 100) + self.pbc_map = sim.add_array('pbc_map', [self.pbc_capacity], Types.Int32) + self.pbc_mult = sim.add_array('pbc_mult', [self.pbc_capacity, sim.ndims()], Types.Int32) class UpdatePBC(Lowerable): diff --git a/src/pairs/sim/properties.py b/src/pairs/sim/properties.py index 6732038396e430eef5fd7fe0899adfa050eb0220..1818511e7471e45f74fba9d2efed9da364791190 100644 --- a/src/pairs/sim/properties.py +++ b/src/pairs/sim/properties.py @@ -1,8 +1,8 @@ from pairs.ir.block import pairs_block, pairs_device_block -from pairs.ir.data_types import Type_Float, Type_Vector from pairs.ir.loops import ParticleFor from pairs.ir.memory import Malloc, Realloc from pairs.ir.properties import RegisterProperty, UpdateProperty +from pairs.ir.types import Types from pairs.ir.utils import Print from pairs.sim.lowerable import Lowerable from functools import reduce @@ -19,9 +19,9 @@ class PropertiesAlloc(Lowerable): capacity = sum(self.sim.properties.capacities) for p in self.sim.properties.all(): sizes = [] - if p.type() == Type_Float: + if Types.is_real(p.type()): sizes = [capacity] - elif p.type() == Type_Vector: + elif p.type() == Types.Vector: sizes = [capacity, self.sim.ndims()] else: raise Exception("Invalid property type!") diff --git a/src/pairs/sim/read_from_file.py b/src/pairs/sim/read_from_file.py index 606f79af41b09000a26fdc3c4f33407e8c4ff7e8..d20a485ca65581f14909a7d1d6f995df70a77f1d 100644 --- a/src/pairs/sim/read_from_file.py +++ b/src/pairs/sim/read_from_file.py @@ -1,7 +1,7 @@ from pairs.ir.block import pairs_block -from pairs.ir.data_types import Type_Float from pairs.ir.functions import Call_Int from pairs.ir.properties import PropertyList +from pairs.ir.types import Types from pairs.sim.grid import MutableGrid from pairs.sim.lowerable import Lowerable @@ -12,7 +12,7 @@ class ReadFromFile(Lowerable): self.filename = filename self.props = PropertyList(sim, props) self.grid = MutableGrid(sim, sim.ndims()) - self.grid_buffer = self.sim.add_static_array("grid_buffer", [self.sim.ndims() * 2], Type_Float) + self.grid_buffer = self.sim.add_static_array("grid_buffer", [self.sim.ndims() * 2], Types.Double) @pairs_block def lower(self): diff --git a/src/pairs/sim/resize.py b/src/pairs/sim/resize.py deleted file mode 100644 index 308ceaa9efad698856e58d8ec94c5edf1249e394..0000000000000000000000000000000000000000 --- a/src/pairs/sim/resize.py +++ /dev/null @@ -1,39 +0,0 @@ -from pairs.ir.branches import Filter -from pairs.ir.data_types import Type_Int, Type_Float, Type_Vector -from pairs.ir.loops import While -from pairs.ir.memory import Realloc -from pairs.ir.properties import UpdateProperty -from pairs.ir.utils import Print -from functools import reduce -import operator - - -class Resize: - def __init__(self, sim, capacity_var, grow_fn=None): - self.sim = sim - self.capacity_var = capacity_var - self.resize_var = self.sim.add_or_reuse_var('resize', Type_Int) - self.grow_fn = grow_fn if grow_fn is not None else (lambda x: x * 2) - - def __iter__(self): - properties = self.sim.properties - self.resize_var.set(1) - for _ in While(self.sim, self.resize_var > 0): - self.resize_var.set(0) - yield self.resize_var - for _ in Filter(self.sim, self.resize_var > 0): - self.sim.add_statement(Print(self.sim, f"Resize {self.capacity_var.name()}")) - self.capacity_var.set(self.grow_fn(self.resize_var)) - for a in self.capacity_var.bonded_arrays(): - a.realloc() - - if properties.is_capacity(self.capacity_var): - capacity = sum(self.sim.properties.capacities) - for p in properties.all(): - if p.type() == Type_Vector: - sizes = [capacity, self.sim.ndims()] - else: - sizes = [capacity] - - Realloc(self.sim, p, reduce(operator.mul, sizes)) - UpdateProperty(self.sim, p, sizes) diff --git a/src/pairs/sim/simulation.py b/src/pairs/sim/simulation.py index 19692ed48305a0b3f637643d60e275702976bd2b..ba8e8f79f7be9f3052f7439f6566bd406aa196a5 100644 --- a/src/pairs/sim/simulation.py +++ b/src/pairs/sim/simulation.py @@ -1,11 +1,11 @@ from pairs.ir.arrays import Arrays from pairs.ir.block import Block from pairs.ir.branches import Filter -from pairs.ir.data_types import Type_Int, Type_Float, Type_Vector -from pairs.ir.layouts import Layout_AoS +from pairs.ir.layouts import Layouts from pairs.ir.module import Module from pairs.ir.properties import Properties from pairs.ir.symbols import Symbol +from pairs.ir.types import Types from pairs.ir.variables import Variables from pairs.graph.graphviz import ASTGraph from pairs.mapping.funcs import compute @@ -20,7 +20,7 @@ from pairs.sim.read_from_file import ReadFromFile from pairs.sim.timestep import Timestep from pairs.sim.variables import VariablesDecl from pairs.sim.vtk import VTKWrite -from pairs.transformations.add_device_copies import add_device_copies +from pairs.transformations.add_device_copies import AddDeviceCopies from pairs.transformations.prioritize_scalar_ops import prioritize_scalar_ops from pairs.transformations.set_used_bin_ops import set_used_bin_ops from pairs.transformations.simplify import simplify_expressions @@ -39,10 +39,10 @@ class Simulation: self.properties = Properties(self) self.vars = Variables(self) self.arrays = Arrays(self) - self.particle_capacity = self.add_var('particle_capacity', Type_Int, particle_capacity) - self.nlocal = self.add_var('nlocal', Type_Int) - self.nghost = self.add_var('nghost', Type_Int) - self.resizes = self.add_array('resizes', 3, Type_Int) + self.particle_capacity = self.add_var('particle_capacity', Types.Int32, particle_capacity) + self.nlocal = self.add_var('nlocal', Types.Int32) + self.nghost = self.add_var('nghost', Types.Int32) + self.resizes = self.add_array('resizes', 3, Types.Int32) self.grid = None self.cell_lists = None self.neighbor_lists = None @@ -86,16 +86,16 @@ class Simulation: def add_real_property(self, prop_name, value=0.0, vol=False): assert self.property(prop_name) is None, f"Property already defined: {prop_name}" - return self.properties.add(prop_name, Type_Float, value, vol) + return self.properties.add(prop_name, Types.Double, value, vol) - def add_position(self, prop_name, value=[0.0, 0.0, 0.0], vol=False, layout=Layout_AoS): + def add_position(self, prop_name, value=[0.0, 0.0, 0.0], vol=False, layout=Layouts.AoS): assert self.property(prop_name) is None, f"Property already defined: {prop_name}" - self.position_prop = self.properties.add(prop_name, Type_Vector, value, vol, layout) + self.position_prop = self.properties.add(prop_name, Types.Vector, value, vol, layout) return self.position_prop - def add_vector_property(self, prop_name, value=[0.0, 0.0, 0.0], vol=False, layout=Layout_AoS): + def add_vector_property(self, prop_name, value=[0.0, 0.0, 0.0], vol=False, layout=Layouts.AoS): assert self.property(prop_name) is None, f"Property already defined: {prop_name}" - return self.properties.add(prop_name, Type_Vector, value, vol, layout) + return self.properties.add(prop_name, Types.Vector, value, vol, layout) def property(self, prop_name): return self.properties.find(prop_name) @@ -103,13 +103,13 @@ class Simulation: def position(self): return self.position_prop - def add_array(self, arr_name, arr_sizes, arr_type, arr_layout=Layout_AoS): + def add_array(self, arr_name, arr_sizes, arr_type, arr_layout=Layouts.AoS): assert self.array(arr_name) is None, f"Array already defined: {arr_name}" return self.arrays.add(arr_name, arr_sizes, arr_type, arr_layout) - def add_static_array(self, arr_name, arr_sizes, arr_type, arr_layout=Layout_AoS): + def add_static_array(self, arr_name, arr_sizes, arr_type, arr_layout=Layouts.AoS, init_value=None): assert self.array(arr_name) is None, f"Array already defined: {arr_name}" - return self.arrays.add_static(arr_name, arr_sizes, arr_type, arr_layout) + return self.arrays.add_static(arr_name, arr_sizes, arr_type, arr_layout, init_value=init_value) def array(self, arr_name): return self.arrays.find(arr_name) @@ -215,7 +215,6 @@ class Simulation: self.vtk_file = filename def generate(self): - # For timestep in Timestep(self): timestep = Timestep(self, self.ntimesteps, [ (EnforcePBC(self, self.pbc), 20), (SetupPBC(self, self.pbc), UpdatePBC(self, self.pbc), 20), @@ -243,6 +242,7 @@ class Simulation: ]) program = Module(self, name='main', block=Block.merge_blocks(decls, body)) + add_copies = AddDeviceCopies(program) # Transformations lower_everything(program) @@ -254,7 +254,7 @@ class Simulation: set_used_bin_ops(program) modularize(program) merge_adjacent_blocks(program) - add_device_copies(program) + add_copies.mutate() # For this part on, all bin ops are generated without usage verification self.check_decl_usage = False diff --git a/src/pairs/sim/vtk.py b/src/pairs/sim/vtk.py index 3fbf8883c67b7a280752df7972851c025c6d28c7..ad090133a90ca95429fde2e8392de7d47bb9c485 100644 --- a/src/pairs/sim/vtk.py +++ b/src/pairs/sim/vtk.py @@ -1,7 +1,7 @@ from pairs.ir.ast_node import ASTNode from pairs.ir.block import pairs_block from pairs.ir.functions import Call_Void -from pairs.ir.lit import as_lit_ast +from pairs.ir.lit import Lit from pairs.sim.lowerable import Lowerable @@ -9,7 +9,7 @@ class VTKWrite(Lowerable): def __init__(self, sim, filename, timestep): super().__init__(sim) self.filename = filename - self.timestep = as_lit_ast(sim, timestep) + self.timestep = Lit.cvt(sim, timestep) @pairs_block def lower(self): diff --git a/src/pairs/transformations/add_device_copies.py b/src/pairs/transformations/add_device_copies.py index 33db9c87525ea8ef41429a8d81f3b08ceb4f56ad..530508135c3047ded26c80cae53e1bd930c0f6f4 100644 --- a/src/pairs/transformations/add_device_copies.py +++ b/src/pairs/transformations/add_device_copies.py @@ -1,14 +1,21 @@ -from pairs.ir.device import DeviceCopy +import math +from pairs.ir.assign import Assign +from pairs.ir.bin_op import BinOp +from pairs.ir.block import Block +from pairs.ir.branches import Filter +from pairs.ir.device import CopyToDevice, CopyToHost from pairs.ir.module import ModuleCall from pairs.ir.mutator import Mutator -from pairs.ir.visitor import Visitor +from pairs.ir.types import Types class AddDeviceCopies(Mutator): def __init__(self, ast): super().__init__(ast) - self.synchronized_props = set() - self.props_to_copy = {} + nprops = len(ast.sim.properties.all()) + self.nflags = math.ceil(nprops / 64.0) + self.prop_hflags = ast.sim.add_static_array('prop_hflags', self.nflags, Types.UInt64, init_value=0xffffffffffffffff) + self.prop_dflags = ast.sim.add_static_array('prop_dflags', self.nflags, Types.UInt64, init_value=0) def mutate_Block(self, ast_node): new_stmts = [] @@ -16,23 +23,42 @@ class AddDeviceCopies(Mutator): for s in stmts: if s is not None: - s_id = id(s) - if isinstance(s, ModuleCall) and s_id in self.props_to_copy: - new_stmts = new_stmts + [DeviceCopy(ast_node.sim, p) for p in self.props_to_copy[s_id]] + if isinstance(s, ModuleCall): + sync_flags = [0] * self.nflags + dirty_flags = [0] * self.nflags - new_stmts.append(s) + for p in s.module.properties_to_synchronize(): + flag_index = p.id() // 64 + bit = p.id() % 64 - ast_node.stmts = new_stmts - return ast_node + if s.module.run_on_device: + new_stmts += [ + Filter(s.sim, + BinOp.cmp(self.prop_dflags[flag_index] & (1 << bit), 0), + Block(s.sim, CopyToDevice(s.sim, p)))] + else: + new_stmts += [ + Filter(s.sim, + BinOp.cmp(self.prop_hflags[flag_index] & (1 << bit), 0), + Block(s.sim, CopyToHost(s.sim, p)))] - def mutate_ModuleCall(self, ast_node): - copying_properties = {p for p in ast_node.module.properties_to_synchronize() if p not in self.synchronized_props} - self.props_to_copy[id(ast_node)] = copying_properties - self.synchronized_props.update(copying_properties) - self.synchronized_props -= ast_node.module.write_properties() - return ast_node + sync_flags[flag_index] |= (1 << bit) + + for p in s.module.write_properties(): + flag_index = p.id() // 64 + bit = p.id() % 64 + dirty_flags[flag_index] |= (1 << bit) + if s.module.run_on_device: + new_stmts += \ + [Assign(s.sim, self.prop_dflags[i], self.prop_dflags[i] | sync_flags[i]) for i in range(self.nflags)] + \ + [Assign(s.sim, self.prop_hflags[i], self.prop_hflags[i] & ~dirty_flags[i]) for i in range(self.nflags)] + else: + new_stmts += \ + [Assign(s.sim, self.prop_hflags[i], self.prop_hflags[i] | sync_flags[i]) for i in range(self.nflags)] + \ + [Assign(s.sim, self.prop_dflags[i], self.prop_dflags[i] & ~dirty_flags[i]) for i in range(self.nflags)] -def add_device_copies(ast): - add_copies = AddDeviceCopies(ast) - add_copies.mutate() + new_stmts.append(s) + + ast_node.stmts = new_stmts + return ast_node diff --git a/src/pairs/transformations/modules.py b/src/pairs/transformations/modules.py index aaaef3f781d8f9fb03112624d3ba9d366be9a056..d2a0127f69f61a560c43df541550a0722b090143 100644 --- a/src/pairs/transformations/modules.py +++ b/src/pairs/transformations/modules.py @@ -3,13 +3,13 @@ from pairs.ir.assign import Assign from pairs.ir.bin_op import BinOp from pairs.ir.block import Block from pairs.ir.branches import Branch, Filter -from pairs.ir.data_types import Type_Vector from pairs.ir.lit import Lit from pairs.ir.loops import While from pairs.ir.memory import Realloc from pairs.ir.module import Module, ModuleCall from pairs.ir.mutator import Mutator from pairs.ir.properties import UpdateProperty +from pairs.ir.types import Types from pairs.ir.variables import Var, Deref from pairs.ir.visitor import Visitor from functools import reduce @@ -182,7 +182,7 @@ class ReplaceModulesByCalls(Mutator): if properties.is_capacity(c): for p in properties.all(): new_capacity = sum(properties.capacities) - sizes = [new_capacity, sim.ndims()] if p.type() == Type_Vector else [new_capacity] + sizes = [new_capacity, sim.ndims()] if p.type() == Types.Vector else [new_capacity] props_realloc += [Realloc(sim, p, reduce(operator.mul, sizes)), UpdateProperty(sim, p, sizes)] resize_stmts.append( diff --git a/src/pairs/transformations/prioritize_scalar_ops.py b/src/pairs/transformations/prioritize_scalar_ops.py index caeb87d1386b5a47d6ac499bac6c0c24a0b28af8..f43637d02a5f41a8ebd9bf700f93d56b662d1201 100644 --- a/src/pairs/transformations/prioritize_scalar_ops.py +++ b/src/pairs/transformations/prioritize_scalar_ops.py @@ -1,6 +1,6 @@ from pairs.ir.bin_op import BinOp -from pairs.ir.data_types import Type_Float, Type_Vector from pairs.ir.mutator import Mutator +from pairs.ir.types import Types class PrioritizeScalarOps(Mutator): @@ -15,30 +15,30 @@ class PrioritizeScalarOps(Mutator): ast_node.lhs = self.mutate(ast_node.lhs) ast_node.rhs = self.mutate(ast_node.rhs) - if ast_node.type() == Type_Vector: + if ast_node.type() == Types.Vector: lhs = ast_node.lhs rhs = ast_node.rhs op = ast_node.op - if( isinstance(lhs, BinOp) and lhs.type() == Type_Vector and rhs.type() == Type_Float and \ + if( isinstance(lhs, BinOp) and lhs.type() == Types.Vector and Types.is_real(rhs.type()) and \ PrioritizeScalarOps.can_rearrange(op, lhs.op) ): - if lhs.lhs.type() == Type_Vector and lhs.rhs.type() == Type_Float: + if lhs.lhs.type() == Types.Vector and Types.is_real(lhs.rhs.type()): ast_node.reassign(lhs.lhs, BinOp(sim, lhs.rhs, rhs, op), op) #return BinOp(sim, lhs.lhs, BinOp(sim, lhs.rhs, rhs, op), op) - if lhs.rhs.type() == Type_Vector and lhs.lhs.type() == Type_Float: + if lhs.rhs.type() == Types.Vector and Types.is_real(lhs.lhs.type()): ast_node.reassign(lhs.rhs, BinOp(sim, lhs.lhs, rhs, op), op) #return BinOp(sim, lhs.rhs, BinOp(sim, lhs.lhs, rhs, op), op) - if( isinstance(rhs, BinOp) and rhs.type() == Type_Vector and lhs.type() == Type_Float and \ + if( isinstance(rhs, BinOp) and rhs.type() == Types.Vector and Types.is_real(lhs.type()) and \ PrioritizeScalarOps.can_rearrange(op, rhs.op) ): - if rhs.lhs.type() == Type_Vector and rhs.rhs.type() == Type_Float: + if rhs.lhs.type() == Types.Vector and Types.is_real(rhs.rhs.type()): ast_node.reassign(rhs.lhs, BinOp(sim, rhs.rhs, lhs, op), op) #return BinOp(sim, rhs.lhs, BinOp(sim, rhs.rhs, lhs, op), op) - if rhs.rhs.type() == Type_Vector and rhs.lhs.type() == Type_Float: + if rhs.rhs.type() == Types.Vector and Types.is_real(rhs.lhs.type()): ast_node.reassign(rhs.rhs, BinOp(sim, rhs.lhs, lhs, op), op) #return BinOp(sim, rhs.rhs, BinOp(sim, rhs.lhs, lhs, op), op) diff --git a/src/pairs/transformations/simplify.py b/src/pairs/transformations/simplify.py index ecba0d6580f239849bf1b813c5073a55bca9427e..d00cab12f65521f97013049cd1998a2a461e62f5 100644 --- a/src/pairs/transformations/simplify.py +++ b/src/pairs/transformations/simplify.py @@ -1,6 +1,6 @@ -from pairs.ir.data_types import Type_Int from pairs.ir.lit import Lit from pairs.ir.mutator import Mutator +from pairs.ir.types import Types class SimplifyExpressions(Mutator): @@ -26,7 +26,7 @@ class SimplifyExpressions(Mutator): return ast_node.rhs if ast_node.op == '*' and ast_node.lhs == 0: - return Lit(sim, 0 if ast_node.type() == Type_Int else 0.0) + return Lit(sim, 0 if ast_node.type() == Types.Int32 else 0.0) return ast_node