diff --git a/notebooks/abc_model_large.ipynb b/notebooks/abc_model_large.ipynb index ea48420..c4d0b99 100644 --- a/notebooks/abc_model_large.ipynb +++ b/notebooks/abc_model_large.ipynb @@ -4,22 +4,14 @@ "cell_type": "code", "execution_count": 1, "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "\u001b[36m\u001b[1m[ \u001b[22m\u001b[39m\u001b[36m\u001b[1mInfo: \u001b[22m\u001b[39mPrecompiling MetagraphOptimization [3e869610-d48d-4942-ba70-c1b702a33ca4]\n" - ] - } - ], + "outputs": [], "source": [ "using MetagraphOptimization" ] }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 3, "metadata": {}, "outputs": [ { @@ -27,9 +19,9 @@ "output_type": "stream", "text": [ "Graph:\n", - " Nodes: Total: 438436, DataTask: 219223, ComputeTaskV: 109600, \n", - " ComputeTaskS2: 40320, ComputeTaskU: 10, ComputeTaskS1: 69272, \n", - " ComputeTaskSum: 1, ComputeTaskP: 10\n", + " Nodes: Total: 438436, ComputeTaskP: 10, ComputeTaskU: 10, \n", + " ComputeTaskV: 109600, ComputeTaskSum: 1, ComputeTaskS2: 40320, \n", + " ComputeTaskS1: 69272, DataTask: 219223\n", " Edges: 628665\n", " Total Compute Effort: 1.903443e6\n", " Total Data Transfer: 1.8040896e7\n", @@ -47,18 +39,18 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 4, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "206.818746 seconds (1.13 G allocations: 25.945 GiB, 1.23% gc time, 0.72% compilation time)\n", + "351.606942 seconds (1.13 G allocations: 25.949 GiB, 1.33% gc time, 0.72% compilation time)\n", "Graph:\n", - " Nodes: Total: 277188, DataTask: 138599, ComputeTaskV: 69288, \n", - " ComputeTaskS2: 40320, ComputeTaskU: 10, ComputeTaskS1: 28960, \n", - " ComputeTaskSum: 1, ComputeTaskP: 10\n", + " Nodes: Total: 277188, ComputeTaskP: 10, ComputeTaskU: 10, \n", + " ComputeTaskV: 69288, ComputeTaskSum: 1, ComputeTaskS2: 40320, \n", + " ComputeTaskS1: 28960, DataTask: 138599\n", " Edges: 427105\n", " Total Compute Effort: 1.218139e6\n", " Total Data Transfer: 1.2235968e7\n", @@ -72,33 +64,6 @@ "print(graph)" ] }, - { - "cell_type": "code", - "execution_count": 4, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "1386.777950 seconds (24.13 M allocations: 66.185 GiB, 0.07% gc time, 0.03% compilation time)\n" - ] - }, - { - "data": { - "text/plain": [ - "compute_e9c23e52_5e4c_11ee_224d_b9f7f711223c (generic function with 1 method)" - ] - }, - "execution_count": 4, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "@time compute_AB_AB7 = get_compute_function(graph, process)" - ] - }, { "cell_type": "code", "execution_count": 5, @@ -108,7 +73,54 @@ "name": "stdout", "output_type": "stream", "text": [ - " 1.159809 seconds (4.65 M allocations: 298.953 MiB, 4.16% gc time, 99.08% compilation time)\n" + "Found 1 NUMA nodes\n", + "CUDA is non-functional\n" + ] + } + ], + "source": [ + "# Get machine and set dictionary caching strategy\n", + "machine = get_machine_info()\n", + "MetagraphOptimization.set_cache_strategy(machine.devices[1], MetagraphOptimization.Dictionary())" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "2315.896312 seconds (87.18 M allocations: 132.726 GiB, 0.11% gc time, 0.04% compilation time)\n" + ] + }, + { + "data": { + "text/plain": [ + "compute__8fd7c454_6214_11ee_3616_0f2435e477fe (generic function with 1 method)" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "@time compute_AB_AB7 = get_compute_function(graph, process, machine)" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + " 1.910169 seconds (4.34 M allocations: 278.284 MiB, 6.25% gc time, 99.23% compilation time)\n" ] }, { @@ -116,358 +128,358 @@ "text/plain": [ "1000-element Vector{ABCProcessInput}:\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [7.297067641509725, 0.0, 0.0, 7.228222199460134]\n", - " A: [7.297067641509725, 0.0, 0.0, -7.228222199460134]\n", + " 2 Incoming particles:\n", + " A: [8.411745173347825, 0.0, 0.0, 8.352092962924948]\n", + " B: [8.411745173347825, 0.0, 0.0, -8.352092962924948]\n", " 8 Outgoing Particles:\n", - " B: [-2.3282358998532704, 0.8697549848718326, -1.6874272456860027, 0.9037687548110497]\n", - " B: [-1.7950616727878386, 0.8822273108812799, -0.9310006383349131, 0.759709939692145]\n", - " B: [-1.4999933965661898, -0.1410505152180896, -0.18020186127033475, 1.0943547099060673]\n", - " B: [-1.6505811903918177, 0.06898822945305061, 0.35478584181328143, 1.2624523344352627]\n", - " B: [-2.250363292401255, -1.102848658096137, 1.2543457128140263, -1.128927197771245]\n", - " B: [-1.0311955832101127, 0.02455791968070782, 0.24479618364224273, 0.053254745208234165]\n", - " B: [-2.9296972047757364, -0.4927435564692796, 1.0617779854349016, -2.4925803916573215]\n", - " A: [-1.109007043033229, -0.10888571510336481, -0.11707597841320116, -0.4520328946241927]\n", + " A: [-2.003428483168789, 1.2386385417950023, -0.8321671195319228, 0.8871291535745444]\n", + " B: [-2.444326994820653, 1.1775023368116424, -0.9536682034633904, 1.6366855721594777]\n", + " B: [-4.289211829680359, -3.7216649121036443, 1.128125248220305, 1.50793959634144]\n", + " B: [-1.2727607454602508, 0.07512513775641204, 0.6370236198332677, -0.45659285653208986]\n", + " B: [-1.8777156401619268, -1.042329795325101, -0.5508846238377632, -1.0657817573524957]\n", + " B: [-1.1322368113474306, 0.0498922458527246, -0.2963537951915457, -0.4377732162313449]\n", + " B: [-1.4340705015357569, 0.7798902829682378, 0.144450581630926, -0.6538068364381232]\n", + " B: [-2.369739340520482, 1.4429461622447262, 0.7234742923401235, -1.4177996555214083]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [7.2752489342950835, 0.0, 0.0, 7.2061950470384675]\n", - " A: [7.2752489342950835, 0.0, 0.0, -7.2061950470384675]\n", + " 2 Incoming particles:\n", + " A: [8.262146117199348, 0.0, 0.0, 8.201405883258813]\n", + " B: [8.262146117199348, 0.0, 0.0, -8.201405883258813]\n", " 8 Outgoing Particles:\n", - " B: [-2.341240544236933, -1.3236357313665439, 0.021740644281282348, -1.6519452415303726]\n", - " B: [-1.409574549584365, 0.13284441484329915, 0.0677274275347828, -0.982174000796411]\n", - " B: [-1.7198571854145448, -0.4774725937733959, -1.2995148112825703, 0.2029529888288706]\n", - " B: [-1.6840881871344047, 0.7545923621161664, 0.30425245239330906, 1.0835930206005606]\n", - " B: [-1.3940699691284604, -0.36965634367010136, -0.41575032455869604, -0.7962015662127381]\n", - " B: [-1.3042076919847856, -0.10554015810915561, -0.020603525646097947, 0.8302978222237647]\n", - " B: [-1.4109035865905348, -0.16670738646793687, -0.12497976754909207, -0.9732613398540193]\n", - " A: [-3.2865561545161373, 1.5555754364276677, 1.467127904827082, 2.2867383167403457]\n", + " A: [-2.022253637967156, 0.040616190652067494, 1.5789161216660899, -0.7712872241073523]\n", + " B: [-1.085155894223277, -0.4013306445746292, 0.044561160964560184, -0.12046298778597243]\n", + " B: [-2.3099664718736963, -0.6028883246226666, 0.7721426580907682, 1.8374619682515352]\n", + " B: [-3.8528592267292674, -1.1057919702708323, -3.154341441424319, -1.6345881470237529]\n", + " B: [-1.445065980497648, -0.3803292238069696, -0.9038074225417192, 0.3559459403736899]\n", + " B: [-1.637993216461692, 0.18276067729419151, -0.6165325663294264, 1.1267244146927589]\n", + " B: [-3.0791604558286254, 1.8666082398498536, 2.1149851082876507, -0.7237684597886623]\n", + " B: [-1.091837350817336, 0.4003550554789843, 0.16407638128639515, -0.0700255046122441]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [7.128857222395858, 0.0, 0.0, 7.058371292111629]\n", - " A: [7.128857222395858, 0.0, 0.0, -7.058371292111629]\n", + " 2 Incoming particles:\n", + " A: [9.522164300929319, 0.0, 0.0, 9.4695096480173]\n", + " B: [9.522164300929319, 0.0, 0.0, -9.4695096480173]\n", " 8 Outgoing Particles:\n", - " B: [-2.2387424246810923, 0.48262787966516907, -0.478530009046727, -1.8841568417407861]\n", - " B: [-2.2717343568852035, 0.2996384006891893, 0.989278021242636, 1.758500160298914]\n", - " B: [-2.288863759829488, -1.5753138344367694, -1.219821878029321, -0.518958784465514]\n", - " B: [-1.1965198718885652, -0.2984623706568589, 0.2110440132874452, 0.5459308029243678]\n", - " B: [-2.0412048759971997, 0.18837892021850178, 1.7692472949269265, -0.028191090894204802]\n", - " B: [-1.3721244113162085, 0.2950214396168393, -0.8455472765311393, -0.284143543736317]\n", - " B: [-1.2477893857541948, 0.2726438292529436, 0.056169243894447725, -0.6924512326593468]\n", - " A: [-1.6007353584397659, 0.3354657356509847, -0.4818394097442683, 1.1034705302728862]\n", + " A: [-2.2614545815907876, 0.09596466269330481, -1.680314037563078, -1.1320390202111377]\n", + " B: [-2.5164555101345942, 2.0544568173259474, 0.7608284478099104, 0.7299969816600982]\n", + " B: [-3.527555187469315, 3.1461533872404055, -0.4998113855480195, 1.1382236350884531]\n", + " B: [-1.5843416170605953, -0.649775322646379, 0.6368565466386346, -0.8260412390634552]\n", + " B: [-1.0715042390215452, 0.33101538188959895, -0.19275377509309963, -0.037364868271978664]\n", + " B: [-1.8269658913133924, -1.2104472444295427, -0.7036857693244948, 0.6143681099517287]\n", + " B: [-1.7510547915269752, 0.35168054121444203, 0.408535633181173, -1.3325210378384098]\n", + " B: [-4.504996783741433, -4.119048223287777, 1.270344339898973, 0.8453774386847008]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [8.78592784031683, 0.0, 0.0, 8.728833141677894]\n", - " A: [8.78592784031683, 0.0, 0.0, -8.728833141677894]\n", + " 2 Incoming particles:\n", + " A: [7.225275339000687, 0.0, 0.0, 7.1557392157883655]\n", + " B: [7.225275339000687, 0.0, 0.0, -7.1557392157883655]\n", " 8 Outgoing Particles:\n", - " B: [-1.8429190025140756, -0.40770268652495845, 1.0373915706018513, -1.0742195764703006]\n", - " B: [-2.8879658474972127, -0.5803475770010614, -0.8959912274618989, -2.4901291425326946]\n", - " B: [-1.0033260956881072, 0.05546077055534206, 0.013578489188090362, -0.058335082493447064]\n", - " B: [-2.9968390870332224, -0.34445049775738557, -0.5371717928927938, 2.752061923919073]\n", - " B: [-3.766379101966564, 2.696872869750841, 2.142546036476936, -1.149775954570847]\n", - " B: [-3.049520802930434, -1.4764668293139291, -1.5076342914468233, 1.9612908179805428]\n", - " B: [-1.003774074073095, -0.03977250933304866, -0.07672361964992376, 0.009696673164828737]\n", - " A: [-1.0211316689309478, 0.09640645962419972, -0.17599516481543767, 0.049410341002844305]\n", + " A: [-1.5721586195862234, -0.6346644373772993, 0.7957285133297657, -0.6600756851617959]\n", + " B: [-1.0093393293662618, -0.11321130994303012, 0.07324286826550051, -0.024177745030521003]\n", + " B: [-2.7355755394886443, 0.2329840388558535, -2.4939308642531, -0.4576033371958622]\n", + " B: [-1.618399027736879, -0.47727357006920945, 1.0132042772011558, -0.6040218911217943]\n", + " B: [-1.7201610947708947, 0.01110230391313025, 0.8839000043421623, -1.0851505486038107]\n", + " B: [-1.792300907703241, 0.8101193095744785, -0.625916307414256, 1.0790171565463333]\n", + " B: [-1.5563810656498285, -1.1865287585293671, 0.12019738267353275, -0.004910793671790455]\n", + " B: [-2.4462350936994026, 1.3574724235754438, 0.2335741258552372, 1.7569228442392408]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [8.59497818662335, 0.0, 0.0, 8.536606470286142]\n", - " A: [8.59497818662335, 0.0, 0.0, -8.536606470286142]\n", + " 2 Incoming particles:\n", + " A: [7.94532861335446, 0.0, 0.0, 7.882147345374172]\n", + " B: [7.94532861335446, 0.0, 0.0, -7.882147345374172]\n", " 8 Outgoing Particles:\n", - " B: [-3.303785350402493, 2.9869208397266744, -0.016309896710415835, 0.9965116788126053]\n", - " B: [-1.303397955397487, 0.6559366127496623, -0.005462599236040695, 0.5182311744756732]\n", - " B: [-2.0796796918405804, 1.5547015102448614, -0.6392026985987374, -0.7066758413873873]\n", - " B: [-2.2171836668721503, -1.5372142315994315, -1.2412749802108427, 0.11005563281983931]\n", - " B: [-1.543259767928983, -0.2880122636303726, 0.753326818085288, -0.8551013696984833]\n", - " B: [-1.4595311971726983, -0.9179460946165987, -0.12356532059864597, -0.5218600333842959]\n", - " B: [-3.6074103495762215, -2.765875098033572, 1.990067456375145, -0.6348038211794063]\n", - " A: [-1.6757083940560864, 0.3114887251587781, -0.71757877910575, 1.0936425795414546]\n", + " A: [-2.118671714766621, -0.6322452591326608, -1.2236882164873555, -1.2615953852509143]\n", + " B: [-2.560753710001491, -1.7412395645571277, -1.5891033163317627, 0.01717533495153369]\n", + " B: [-1.5550581087132076, -0.639122838128628, -0.9624327134008909, 0.2888788525193626]\n", + " B: [-2.181477133464949, 0.4918918998013713, 1.8559068969600523, -0.2692479016749415]\n", + " B: [-1.2628370388798702, -0.4013500667990802, 0.24813196852393224, 0.6100049482124643]\n", + " B: [-1.901139724448186, 1.3625293914322611, -0.8176066997802711, 0.2989401174693193]\n", + " B: [-2.2302691928842697, -0.1867565668705846, 1.9609184768063308, 0.3066290670808993]\n", + " B: [-2.0804506035503256, 1.7462930042544484, 0.5278736037099664, 0.009214966692276028]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [6.669200844748512, 0.0, 0.0, 6.593803144437531]\n", - " A: [6.669200844748512, 0.0, 0.0, -6.593803144437531]\n", + " 2 Incoming particles:\n", + " A: [5.597768901835826, 0.0, 0.0, 5.507723366179557]\n", + " B: [5.597768901835826, 0.0, 0.0, -5.507723366179557]\n", " 8 Outgoing Particles:\n", - " B: [-1.18373226006521, 0.39371727970580117, -0.2632195982479301, 0.4206235969110058]\n", - " B: [-2.119478680160756, 1.408133215595378, 1.1321058108188813, 0.477165753070277]\n", - " B: [-1.329423150415496, 0.14179491242559344, -0.4771256592779384, 0.7208406349044663]\n", - " B: [-1.578609687871729, -1.0594661135121535, -0.24077990318805478, -0.5581802031447219]\n", - " B: [-1.7164578941688053, 0.44657264095470856, 0.8718727422362944, -0.9932967835196647]\n", - " B: [-2.11819827099359, -1.4795553845809009, -0.7048891282932129, -0.8948804925865415]\n", - " B: [-1.8709573462291487, -0.189927903614252, 0.3160649103701958, 1.5376968996750284]\n", - " A: [-1.4215443995922872, 0.33873135302582497, -0.6340291744182351, -0.7099694053098498]\n", + " A: [-1.0009073340208385, 0.03522831505376105, -0.010844681575969111, -0.021374049609080487]\n", + " B: [-1.3943823799403026, -0.886019044587247, 0.21582726795187737, -0.3356948979730148]\n", + " B: [-1.0593061926863385, 0.3261714964515558, -0.10930051701751846, -0.06160488410736567]\n", + " B: [-1.0190344437384602, 0.02512063114228613, 0.04379726771854621, -0.18942531709556668]\n", + " B: [-1.0919277601624486, -0.39612686480944176, 0.07078221355247243, -0.17429750036714983]\n", + " B: [-1.8292258091360047, 1.1565638126055895, 0.329244535677723, 0.9486966026643375]\n", + " B: [-1.7379569022732355, 0.6562121276078657, 0.7749535141539342, -0.9946491284065995]\n", + " B: [-2.0627969817140217, -0.9171504734643696, -1.3144596004610647, 0.8283491748944392]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.470903601313192, 0.0, 0.0, 5.378734629525949]\n", - " A: [5.470903601313192, 0.0, 0.0, -5.378734629525949]\n", + " 2 Incoming particles:\n", + " A: [6.860362769879496, 0.0, 0.0, 6.787089017712134]\n", + " B: [6.860362769879496, 0.0, 0.0, -6.787089017712134]\n", " 8 Outgoing Particles:\n", - " B: [-1.4021158374469955, -0.33713368996236237, 0.828716134884258, -0.40681600815915203]\n", - " B: [-1.1563583213717814, 0.4669713256040394, 0.28028271633519913, -0.20135527654653723]\n", - " B: [-1.680077997136158, 1.029883999585246, -0.8569453707516226, -0.16626982710854143]\n", - " B: [-1.0859502536933687, 0.22568458750125922, 0.32038573500001044, 0.16033527768267747]\n", - " B: [-1.134683686030051, -0.18046292205015352, -0.4386242234263053, 0.25009796426907194]\n", - " B: [-1.274458758726785, -0.7413070027812927, 0.20162414481851987, -0.18454473590171666]\n", - " B: [-1.7725632726477032, 0.11110106661695422, -1.0581457304680515, 1.004970010312917]\n", - " A: [-1.435599075573539, -0.5747373645136903, 0.7227065936079918, -0.4564174045487203]\n", + " A: [-2.1483538194490985, 1.8204047500578164, 0.1342978924269131, -0.532461036694855]\n", + " B: [-1.2136825716769264, 0.12932805245115084, -0.43609629710270903, -0.5158678699965871]\n", + " B: [-3.3642987422516573, -1.7653207470663739, 0.533955101409256, 2.630026736893018]\n", + " B: [-1.053677321951765, 0.11000921943972916, 0.04739423847128557, -0.30965732123337875]\n", + " B: [-1.2932387925896982, -0.6843810329952256, 0.045636429012288295, -0.4494513240410521]\n", + " B: [-1.1237194151971648, -0.45140047643622017, 0.19994785657222267, -0.13785422959193222]\n", + " B: [-1.7619597212239484, 1.3299261857304887, 0.561749934748497, 0.1422512233127988]\n", + " B: [-1.7617951554187332, -0.488565951181366, -1.0868851555377534, -0.8269861786480115]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.797477162545017, 0.0, 0.0, 5.710581533454454]\n", - " A: [5.797477162545017, 0.0, 0.0, -5.710581533454454]\n", + " 2 Incoming particles:\n", + " A: [9.57507915889135, 0.0, 0.0, 9.522717096450755]\n", + " B: [9.57507915889135, 0.0, 0.0, -9.522717096450755]\n", " 8 Outgoing Particles:\n", - " B: [-1.5450719004726667, 0.8517269263387147, -0.6575731998066975, -0.47896336757188956]\n", - " B: [-1.8681787383135382, 0.9239774620581589, 0.05662442628207056, 1.2779480123399205]\n", - " B: [-1.328069221534724, -0.42458851386081026, 0.31994691787104906, -0.6936327708738483]\n", - " B: [-1.06027071864171, 0.21126510016283465, 0.19859954153249007, -0.20024803710718375]\n", - " B: [-1.1831265177723247, 0.20108685767548962, -0.2946698611954912, 0.5220364983689306]\n", - " B: [-1.9417129471209476, -1.1911753540025534, 0.6799034923902431, -0.9429112821838329]\n", - " B: [-1.5809251620841955, -0.8166741148237361, -0.2861634729958438, 0.8663014631239887]\n", - " A: [-1.0875991191499284, 0.24438163645190153, -0.01666784407782057, -0.35053051609608543]\n", + " A: [-3.4305207411483516, 2.6682294806816835, -1.883054168339437, -0.3211401453721668]\n", + " B: [-2.185574270107571, 1.4558232366821502, 1.2235951792097912, 0.40016050668089054]\n", + " B: [-3.0259648593433583, -0.9184166853584697, -0.10930222461665634, -2.7020412923806107]\n", + " B: [-3.246659025038245, -2.493839704051011, -1.0189869044243565, 1.5110340975546257]\n", + " B: [-1.4247322676315595, 0.05954103854817788, 0.9940897925990366, -0.19519831815252583]\n", + " B: [-1.4889906300188005, 0.5912092032645169, -0.19371449043911573, -0.9110650198822441]\n", + " B: [-1.1268952499657272, 0.36236812621338876, -0.3636229828302436, 0.07975319340034331]\n", + " B: [-3.220821274529085, -1.7249146959804351, 1.350995798840981, 2.1384969781516885]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.1827176380704065, 0.0, 0.0, 5.085328122743516]\n", - " A: [5.1827176380704065, 0.0, 0.0, -5.085328122743516]\n", + " 2 Incoming particles:\n", + " A: [8.472852690841874, 0.0, 0.0, 8.413633740584764]\n", + " B: [8.472852690841874, 0.0, 0.0, -8.413633740584764]\n", " 8 Outgoing Particles:\n", - " B: [-1.9685088100342798, -0.3904041497416891, -1.5627655525026516, 0.5295048280782026]\n", - " B: [-1.030160361155713, -0.07535582463512125, 0.19063710907839407, -0.13859784281244267]\n", - " B: [-1.2219225483553735, 0.6840170034583941, 0.15631124179375314, -0.0279687119471718]\n", - " B: [-1.1507364218251361, -0.07738095134041947, 0.5640840339340665, 0.003962769894949415]\n", - " B: [-1.1688834731663604, -0.16423932962218155, 0.10659198850061305, -0.572671078747823]\n", - " B: [-1.3139731925816502, -0.28327679049052584, -0.3461643179576484, -0.7255687946470113]\n", - " B: [-1.3819957593386174, 0.4082395984907682, 0.40574756908515375, 0.7606718209816284]\n", - " A: [-1.1292547096836842, -0.10159955611922504, 0.4855579280683192, 0.17066700919966749]\n", + " A: [-1.1530011327357317, 0.34211475449117323, -0.45923141786607913, -0.03841369149190832]\n", + " B: [-2.62915067223017, 1.042431210232047, 0.6288618003426715, -2.1048285595963105]\n", + " B: [-1.1265473249385953, -0.4344882737979479, -0.1553035746380426, 0.2370856700921221]\n", + " B: [-1.4826889242092416, -0.5889894099544346, -0.45026884678673923, -0.8054290077639529]\n", + " B: [-4.118520088756618, -2.101194203160593, -3.0008966741533745, 1.5943054265577095]\n", + " B: [-3.9992129109551517, 1.0607252636964415, 3.6847882851419875, 0.539352496783755]\n", + " B: [-1.3172538577755006, 0.4084669000294691, -0.6351790575407871, 0.4060296568803221]\n", + " B: [-1.1193304700827373, 0.2709337584638445, 0.3872294855003629, 0.17189800853826395]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.69426264881418, 0.0, 0.0, 5.60576730819968]\n", - " A: [5.69426264881418, 0.0, 0.0, -5.60576730819968]\n", + " 2 Incoming particles:\n", + " A: [5.913538688235051, 0.0, 0.0, 5.828373685450576]\n", + " B: [5.913538688235051, 0.0, 0.0, -5.828373685450576]\n", " 8 Outgoing Particles:\n", - " B: [-1.1686642377734457, 0.3119007269546548, 0.07983898811071112, -0.5119763404232704]\n", - " B: [-1.3698446786688139, 0.024422137551429482, -0.9336560540551144, -0.06453197347763913]\n", - " B: [-2.286375537440295, -0.7489461722148772, 1.3243906862302417, -1.3829613297401602]\n", - " B: [-1.2764203314056075, 0.19147075967274907, -0.6988385529595283, -0.3228195897298891]\n", - " B: [-1.1000453527174736, 0.3930525082621053, -0.18973683240054473, 0.14003370385298727]\n", - " B: [-1.3409037805805533, -0.6410325458506799, 0.15263734740708942, 0.6031600650838413]\n", - " B: [-1.3933443408324893, 0.4598121590148031, 0.6478969707730007, 0.556965659457779]\n", - " A: [-1.452927038209682, 0.009320426609815335, -0.3825325531058559, 0.9821298049763512]\n", + " A: [-1.6813734506828508, -1.1942921586618185, -0.384476919421686, 0.5028522833318558]\n", + " B: [-1.412586238014363, 0.010275442474480664, 0.8780055986304257, -0.4737092609218783]\n", + " B: [-1.5338446207986793, 1.1234162145644635, 0.1670274754582306, -0.25043392751132176]\n", + " B: [-1.4260274101869397, 0.9023875675844153, -0.4646063309051003, -0.058239245843783906]\n", + " B: [-1.1055189977833793, -0.3699146930280028, 0.2809292901965394, -0.08008812803177658]\n", + " B: [-1.1926016738662872, 0.4242726765633766, 0.34415633034138016, -0.3519202590308968]\n", + " B: [-1.4188061371181722, 0.47356120240959365, 0.33662773751584696, 0.8218469496393668]\n", + " B: [-2.0563188480194308, -1.3697062519065082, -1.1576631818156364, -0.1103084116315648]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [6.367432685308519, 0.0, 0.0, 6.288417845685452]\n", - " A: [6.367432685308519, 0.0, 0.0, -6.288417845685452]\n", + " 2 Incoming particles:\n", + " A: [6.062750568659298, 0.0, 0.0, 5.979711068085032]\n", + " B: [6.062750568659298, 0.0, 0.0, -5.979711068085032]\n", " 8 Outgoing Particles:\n", - " B: [-1.390267258638053, 0.6275324547731649, 0.20451880141536874, 0.7051369572749351]\n", - " B: [-1.9039437559086116, 0.4510910335703079, -0.6590504847861329, -1.4096705869099437]\n", - " B: [-1.1853333708320322, 0.3254579737444668, 0.33076168516541243, -0.4355330239611121]\n", - " B: [-1.125369006990044, -0.11551337227603503, -0.5030416237325495, 0.007822244671168007]\n", - " B: [-1.1460227184362763, -0.5367962179605811, -0.1365607258769146, 0.08104973598513128]\n", - " B: [-2.7512633229570334, -1.6948481597767724, 1.5466514102511044, 1.1422823655813548]\n", - " B: [-1.5749940303967573, -0.15965379863878912, -1.0544249772390906, 0.5859222028050912]\n", - " A: [-1.657671906458233, 1.102730086564237, 0.27114591480280403, -0.6770098954466284]\n", + " A: [-1.1157392140073992, -0.0424317149721654, 0.4662958482482185, -0.16013033799016252]\n", + " B: [-2.395340693850968, -1.171776361305547, -1.746409249879336, 0.5609384374776449]\n", + " B: [-1.0289722654275464, 0.23139962589771268, 0.07055331234631396, 0.01613586906426155]\n", + " B: [-1.212565238145815, -0.6377842504248107, 0.04163119753237706, 0.24862129848767983]\n", + " B: [-1.8156755638105053, -0.3987185167288875, 1.2510245302740972, 0.7567290942527487]\n", + " B: [-2.003891077687212, 1.2159250459117166, 0.38048599808923245, -1.1799729400359336]\n", + " B: [-1.4663599649673638, 0.593985649692284, -0.7733488095969958, -0.44645740391848543]\n", + " B: [-1.086957119421786, 0.20940052192969777, 0.3097671729860923, 0.20413598266224653]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.936871910217603, 0.0, 0.0, 5.85204648634397]\n", - " A: [5.936871910217603, 0.0, 0.0, -5.85204648634397]\n", + " 2 Incoming particles:\n", + " A: [7.088363151833832, 0.0, 0.0, 7.017470496715726]\n", + " B: [7.088363151833832, 0.0, 0.0, -7.017470496715726]\n", " 8 Outgoing Particles:\n", - " B: [-1.1977447908071144, -0.5208843383505731, -0.29466892923692334, 0.2764820285462133]\n", - " B: [-1.4339638808744681, 0.17353187662173764, 0.9292299695494735, 0.4033246374073723]\n", - " B: [-1.0481012050053067, 0.19708368984168353, -0.24156408393499315, -0.03634485499504191]\n", - " B: [-2.2241539774877466, 1.0115406169999834, -1.0380370787420174, 1.3587220167829017]\n", - " B: [-1.0522861512714377, -0.1902262203963507, 0.1279208048019239, -0.23400084813992042]\n", - " B: [-2.3818245359738817, -0.4952353098736381, 0.6157891811369108, -2.0121217141157963]\n", - " B: [-1.1852543863662754, 0.5457506201424419, 0.2954807101179548, -0.14026892372448407]\n", - " A: [-1.3504148926489736, -0.7215609349852846, -0.39415057369232925, 0.38420765823875563]\n", + " A: [-3.1474601133746627, 0.14412280671945385, 2.7364508363525357, 1.1821889028802701]\n", + " B: [-1.256451004773104, 0.1153142495225348, -0.7455659837621855, -0.09748392231091944]\n", + " B: [-1.4964417911663928, -0.0996845872039782, -0.8492275192498467, 0.7128910421459969]\n", + " B: [-3.2499484244824526, -0.8927423628721523, -1.0242747556675866, -2.777775559729678]\n", + " B: [-1.0489067674373789, -0.31603136975662793, 0.016268502528308637, -0.008057042333727152]\n", + " B: [-1.6957667777105587, 1.0857339287179024, 0.6252297389508089, 0.5530773670555896]\n", + " B: [-1.243679438145053, 0.06348629097723194, -0.7145975145476898, 0.17904867473682565]\n", + " B: [-1.0380719865780628, -0.10019895610436466, -0.044283304604344965, 0.2561105375556422]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [9.852912437162026, 0.0, 0.0, 9.802034660945763]\n", - " A: [9.852912437162026, 0.0, 0.0, -9.802034660945763]\n", + " 2 Incoming particles:\n", + " A: [9.842517855137334, 0.0, 0.0, 9.791586068084028]\n", + " B: [9.842517855137334, 0.0, 0.0, -9.791586068084028]\n", " 8 Outgoing Particles:\n", - " B: [-4.3217547214772, 0.3006617090826956, 0.30060056695047277, 4.182918324382032]\n", - " B: [-1.8398073471556307, 0.7372918490442457, -1.235374697300333, 0.5613743503677984]\n", - " B: [-1.8743147864753342, -0.732045557595005, -0.9521643334086932, -1.0346730413951422]\n", - " B: [-1.3953205341341666, 0.4336744412700569, -0.46004135572480787, -0.7397349680719717]\n", - " B: [-1.950304091083263, 0.8965289321581407, 1.0137006195122968, -0.9860694577461983]\n", - " B: [-2.6005709642066717, 2.0489705793122135, 0.5748540328357682, -1.1109598309211022]\n", - " B: [-2.3750535744184678, -0.8155704501301804, -0.0947720055798232, -1.9916682929621512]\n", - " A: [-3.3486988553733195, -2.869511503142167, 0.8531971727151203, 1.1188129163467355]\n", + " A: [-1.0081083393933719, 0.09315850477843095, -0.05390640772287413, 0.06854207575149836]\n", + " B: [-1.2533776879399583, -0.09567218890986252, -0.022562148977002077, -0.749195175056841]\n", + " B: [-4.199102452438099, 3.1204551726062775, 2.23725963921713, 1.3747327844190023]\n", + " B: [-5.1018332572388285, -4.999892707918183, 0.09407944148737099, -0.14465321518774693]\n", + " B: [-3.7582268429742243, 2.1814891293707577, -1.5410280493623207, -2.4475715991095703]\n", + " B: [-1.1792132348986593, 0.6125282131702711, -0.12369433042852651, -0.007263198361168502]\n", + " B: [-1.3600169327450258, -0.07835376476887727, -0.6694537001487819, 0.6287594836317273]\n", + " B: [-1.8251569626465018, -0.8337123583288142, 0.07930555593500455, 1.2766488439130985]\n", "\n", " ⋮\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.1272054195735475, 0.0, 0.0, 5.028740937302731]\n", - " A: [5.1272054195735475, 0.0, 0.0, -5.028740937302731]\n", + " 2 Incoming particles:\n", + " A: [9.861596443743153, 0.0, 0.0, 9.810763702141012]\n", + " B: [9.861596443743153, 0.0, 0.0, -9.810763702141012]\n", " 8 Outgoing Particles:\n", - " B: [-1.2759132086369238, 0.7088484304225325, -0.29887603116913986, -0.19016186961182752]\n", - " B: [-1.1779522775983573, 0.41803841905140154, -0.45675251170539183, -0.06475022430060037]\n", - " B: [-1.1481761366626901, -0.4437023136420629, 0.34830654963136826, -0.010919942959201066]\n", - " B: [-1.4379810868005531, -0.6351701874948475, -0.059163905195223354, 0.8129256246643419]\n", - " B: [-1.3828873393138725, -0.8812833033405845, 0.23611519283598345, -0.2827839249316266]\n", - " B: [-1.33376143924824, 0.4383405825580403, 0.7637478896663866, -0.058875050219558064]\n", - " B: [-1.278378917935277, -0.007026488522286364, -0.31396565194856196, -0.7318666925587813]\n", - " A: [-1.219360432951181, 0.4019548609678069, -0.21941153211542153, 0.5264320799172535]\n", + " A: [-1.8179384769334697, 0.9572508915748105, -0.9794338269553214, 0.6551949443563104]\n", + " B: [-2.1028582035167607, -0.7676665378472812, 0.6218562087985972, -1.5639678917247444]\n", + " B: [-3.1263866679666865, 2.3808322573838474, -1.6099851834448586, 0.7168535896041835]\n", + " B: [-5.177179415841987, -1.3605325795287053, 4.805481256903438, -0.9270855911989424]\n", + " B: [-1.2605754590213083, -0.023284320526100116, -0.14250915308265208, 0.7537900699744495]\n", + " B: [-2.712925004518324, -1.4343063146086636, -1.452340398698398, 1.4810249296764189]\n", + " B: [-2.3798188172675734, 0.6412170781802653, -1.487389994435021, -1.4283029321979925]\n", + " B: [-1.1455108424201939, -0.39351047462817185, 0.24432109091421514, 0.3124928815103169]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [7.6029796810241095, 0.0, 0.0, 7.536929084850505]\n", - " A: [7.6029796810241095, 0.0, 0.0, -7.536929084850505]\n", + " 2 Incoming particles:\n", + " A: [5.611571819338176, 0.0, 0.0, 5.521751378284825]\n", + " B: [5.611571819338176, 0.0, 0.0, -5.521751378284825]\n", " 8 Outgoing Particles:\n", - " B: [-2.495625599363338, 0.17195331697679445, -1.421295024808554, 1.7828347207278505]\n", - " B: [-2.3247770827115106, -0.4842961856772881, 1.5916928687740521, -1.2792808527969537]\n", - " B: [-1.6004875132645686, -0.7246443707991035, -0.6287268529374866, -0.8007205257643256]\n", - " B: [-2.2935495836704267, 1.6828759072541282, -0.6216953077311024, 1.020682770445115]\n", - " B: [-1.6841223705419472, -0.15136722397138147, -1.088694434115097, -0.7925279500395149]\n", - " B: [-1.7610877078517306, 0.6608553615709418, 1.0261342048695203, -0.7821436565147093]\n", - " B: [-1.0851670972782637, 0.17258442918121256, 0.3025146696084896, 0.23724906425778386]\n", - " A: [-1.9611424073664336, -1.3279612345353033, 0.8400698763401785, 0.6139064296847537]\n", + " A: [-1.0759150984150232, -0.3903007964405737, 0.045679777762273936, -0.05632002484775736]\n", + " B: [-1.021003529021616, -0.07269336486556076, 0.11388411952175649, 0.15554513267817288]\n", + " B: [-1.6939705353811365, -0.1440535362616654, -0.25084793375093056, -1.3363607550219565]\n", + " B: [-1.185801144621379, -0.31618880274591826, 0.5459120200606805, -0.09016131075324207]\n", + " B: [-1.197431131926246, 0.16472462054297168, -0.17198607315407527, -0.6141074056988615]\n", + " B: [-1.0089442324730478, -0.12314856400749492, -0.027052115631495212, -0.04550910308256443]\n", + " B: [-2.703474424566498, 0.16902217864171518, -0.14049660772763695, 2.502092358533033]\n", + " B: [-1.3366035422714058, 0.7126382651365266, -0.11509318708057305, -0.5151788918068239]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [6.992590856163222, 0.0, 0.0, 6.920717223069984]\n", - " A: [6.992590856163222, 0.0, 0.0, -6.920717223069984]\n", + " 2 Incoming particles:\n", + " A: [8.775111706253933, 0.0, 0.0, 8.717946171962454]\n", + " B: [8.775111706253933, 0.0, 0.0, -8.717946171962454]\n", " 8 Outgoing Particles:\n", - " B: [-2.822980650932899, -2.564595508900629, -0.09432122198604756, -0.619009804729552]\n", - " B: [-1.0974277084261912, 0.017540537657498946, -0.231887659602663, -0.3876441900560964]\n", - " B: [-1.1239874528072817, -0.4945185041136732, -0.09310437746946441, -0.10065196497535307]\n", - " B: [-2.1713139360453084, 1.8206777932997238, 0.006028027938971819, 0.6322185102707673]\n", - " B: [-2.723748045321534, 0.7655804205481372, -1.9920897904718349, 1.3653821079698159]\n", - " B: [-1.1799610763673014, 0.09222483207708872, 0.5878213304380843, -0.19562414363322736]\n", - " B: [-1.3511131845747593, -0.0920425289119762, 0.8345532514223162, -0.34721157950689996]\n", - " A: [-1.5146496578511677, 0.4551329583438295, 0.9830004397306376, -0.3474589353394537]\n", + " A: [-2.2750151423103953, 1.8467170131598, 0.8729070809034145, 0.05799482008261441]\n", + " B: [-1.5756212156561644, 1.0377655822554295, 0.3001332912880399, 0.5617337616455574]\n", + " B: [-1.6945981163898138, -0.5153714693329569, 0.050834292767083435, 1.2662823142365867]\n", + " B: [-2.630307241578496, -0.5126707368632603, 1.3344949978186418, -1.9684532002212756]\n", + " B: [-3.0848917600353407, -2.827901193400985, -0.46541663267058264, -0.5503811129833626]\n", + " B: [-2.812675339815945, 2.346626876124383, -1.1757879806725677, 0.14834923648401968]\n", + " B: [-1.695817659938434, -0.3817827622891304, -0.19598317768122073, 1.3006267920675472]\n", + " B: [-1.7812969367832734, -0.9933833096532803, -0.7211818717528079, -0.8161526113116866]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [6.147153446646183, 0.0, 0.0, 6.065269614503055]\n", - " A: [6.147153446646183, 0.0, 0.0, -6.065269614503055]\n", + " 2 Incoming particles:\n", + " A: [6.832501783927461, 0.0, 0.0, 6.758925996589395]\n", + " B: [6.832501783927461, 0.0, 0.0, -6.758925996589395]\n", " 8 Outgoing Particles:\n", - " B: [-1.016188912560254, -0.13697636540681832, 0.11748833306507175, 0.008594935946244903]\n", - " B: [-1.1360093083664402, -0.5079347349092443, -0.17963659939393273, -0.01581600221476525]\n", - " B: [-1.7092824014796542, -0.7891675791008793, -0.7223044431106161, 0.8815538279462988]\n", - " B: [-1.9192700349186136, 0.1237305478301286, -1.0851075251029303, -1.2209954452966416]\n", - " B: [-1.469286709386631, -0.2635598190385343, 1.0027221080818196, 0.28963430413630475]\n", - " B: [-1.5088265360380027, -0.732569485372415, -0.8401661674887627, 0.18444586186975667]\n", - " B: [-2.0179299753278324, 1.5035832195688477, 0.899191457478353, -0.052283935922221136]\n", - " A: [-1.5175130152149356, 0.8028942164289148, 0.8078128364709978, -0.07513354646497722]\n", + " A: [-1.0114752465345387, -0.11558780230223581, -0.03776248532804595, -0.09108034372406744]\n", + " B: [-1.031154612454516, -0.04425244057817861, -0.0789748074180023, -0.23470095032271823]\n", + " B: [-2.2555952063288855, 1.7491237654517413, -0.4233804231771479, -0.9214254203222908]\n", + " B: [-2.089561973736715, 0.9235335217807571, 1.3477207222453012, -0.8348676128969853]\n", + " B: [-1.3199981586264844, -0.6902187266500668, -0.06216816149242132, -0.5119847340063199]\n", + " B: [-1.0105028642371863, -0.09317036739551621, -0.041275823376393385, -0.1035935696630954]\n", + " B: [-1.2426376312622325, -0.48126859609618416, 0.05225488689293943, -0.5565952280036419]\n", + " B: [-3.704077874674367, -1.2481593542103167, -0.7564139083462295, 3.254247858939119]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [8.476921541840353, 0.0, 0.0, 8.417731216100751]\n", - " A: [8.476921541840353, 0.0, 0.0, -8.417731216100751]\n", + " 2 Incoming particles:\n", + " A: [8.775903429741401, 0.0, 0.0, 8.718743086485969]\n", + " B: [8.775903429741401, 0.0, 0.0, -8.718743086485969]\n", " 8 Outgoing Particles:\n", - " B: [-1.7538473485555315, -0.9965865865820887, -1.0269887958877189, 0.16759985262828772]\n", - " B: [-2.2424706680343123, 1.5336690696555233, -0.12788621971414102, -1.2884793349462171]\n", - " B: [-1.9516293942416962, -0.332998801919277, -1.6407841791068538, 0.07613388195268905]\n", - " B: [-2.859281760370176, 2.5141699034195697, 0.7891164012469956, 0.48139088816449227]\n", - " B: [-1.305183288774148, -0.38321818731386625, -0.02282033150337396, -0.7457388756644321]\n", - " B: [-1.8024514296684413, 0.16127952536927562, 1.0125217007678309, -1.0943582030051626]\n", - " B: [-2.659766637628699, -2.4121666849276377, 0.3691192808476085, 0.3457765279402697]\n", - " A: [-2.3792125564077033, -0.0841482377014984, 0.647722143349652, 2.057675262930073]\n", + " A: [-1.7137666526922533, 1.1358800766324049, 0.08268488211087159, 0.7999598750311686]\n", + " B: [-1.1669696745288112, -0.04351472671445914, 0.5992401461010018, 0.028912577361687116]\n", + " B: [-3.5481649603318184, 0.4490928742123019, 1.0371640968528058, -3.21124287656006]\n", + " B: [-1.276578701414564, -0.08287623449031867, -0.6317118623642547, -0.47299559576203803]\n", + " B: [-4.955351547203613, -2.6459981607514886, 0.5026315754882429, 4.037519558961317]\n", + " B: [-2.3130557250521284, 1.4242375193555785, -1.5228161303749386, 0.05296516521446809]\n", + " B: [-1.4353464814836179, 0.25997106791735547, -0.029309860840599063, -0.9958792586507745]\n", + " B: [-1.1425731167759967, -0.4967924161613736, -0.03788284697312998, -0.23923944559576807]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [8.624646884670907, 0.0, 0.0, 8.56647733232649]\n", - " A: [8.624646884670907, 0.0, 0.0, -8.56647733232649]\n", + " 2 Incoming particles:\n", + " A: [8.907102929629284, 0.0, 0.0, 8.850789942090511]\n", + " B: [8.907102929629284, 0.0, 0.0, -8.850789942090511]\n", " 8 Outgoing Particles:\n", - " B: [-3.867443674456446, 2.055526777157907, 3.030742490685273, 0.7392768078567271]\n", - " B: [-1.7934878303680706, -0.5000733363648106, -1.0116698419390304, -0.9711072993477046]\n", - " B: [-2.6128053379450074, -1.4077167277359781, -1.5035505333762953, 1.258737916339256]\n", - " B: [-2.5295672204001716, 0.6495125229101625, 2.0471142470161805, 0.886660625475892]\n", - " B: [-1.5638606530033585, -0.08397443970070877, -0.6384907390237163, -1.01535117652465]\n", - " B: [-1.398281438823116, -0.46529071643315806, -0.009094789780325336, -0.8594258642589327]\n", - " B: [-1.8357084823189076, 0.46249283401972147, -1.1869685935882734, -0.864309879830763]\n", - " A: [-1.6481391320267396, -0.7104769138531365, -0.7280822399938128, 0.8255188702901759]\n", + " A: [-2.946046511363992, -0.9439001466724447, 2.1873638734369836, 1.4155146927582347]\n", + " B: [-3.7848309582649415, -2.22832689875391, -0.18756115269295068, -2.885190709282662]\n", + " B: [-1.0159875652570234, 0.04172671107403079, -0.15271016054388648, 0.08467125371989566]\n", + " B: [-2.0867601165869685, -1.8155383548303043, -0.021995043965926685, -0.24063350631004576]\n", + " B: [-4.34790862339958, 3.6266859724946396, -1.8990793068549607, 1.0700261868843775]\n", + " B: [-1.1578951917200673, 0.35622580432348594, 0.23734793715600985, 0.3968506117802061]\n", + " B: [-1.4421363377447174, 1.0156020669389267, -0.20020339434090184, -0.0907097523285523]\n", + " B: [-1.0326405549212787, -0.052475154574424254, 0.03683724780563263, 0.24947122277854633]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.001252847065808, 0.0, 0.0, 4.9002581605752]\n", - " A: [5.001252847065808, 0.0, 0.0, -4.9002581605752]\n", + " 2 Incoming particles:\n", + " A: [6.294285658794556, 0.0, 0.0, 6.214340830249562]\n", + " B: [6.294285658794556, 0.0, 0.0, -6.214340830249562]\n", " 8 Outgoing Particles:\n", - " B: [-1.2253065319501055, 0.5822781598199206, 0.3314418067646216, -0.22907328644982872]\n", - " B: [-1.0786346171567884, 0.1820904562535535, 0.3604976786746933, 0.018361011423713165]\n", - " B: [-1.443011976427815, -0.8651359890021318, -0.2856682661617125, 0.502212033264408]\n", - " B: [-1.173769929336385, -0.5289514976498968, 0.2948922549388864, 0.10480800601734341]\n", - " B: [-1.4017613372429005, 0.6451966342855364, 0.06876704973583925, -0.7375142321109804]\n", - " B: [-1.023640220772291, 0.022027108004137586, -0.10056103790303386, -0.19298079114664024]\n", - " B: [-1.3049794561819603, 0.7202426203017741, -0.18998374147348418, 0.38487417026027565]\n", - " A: [-1.3514016250633702, -0.7577474920128907, -0.4793857445758094, 0.1493130887417088]\n", + " A: [-1.06844272609547, -0.2848922847204133, 0.15179083391454987, -0.19330232226393051]\n", + " B: [-2.114647837734541, -1.6956804594706658, -0.38950327120442063, 0.6668511518515798]\n", + " B: [-1.494217345848325, 0.7529614584695401, -0.5432224448027106, -0.6088053006963738]\n", + " B: [-1.3783311635115514, 0.9215501628423943, 0.0395584401371469, -0.2213079833313275]\n", + " B: [-1.7816982863175768, 0.5393674002906785, 0.38766524831377364, 1.316528482874748]\n", + " B: [-1.659172767477475, 0.17135237894801714, -1.2297516401309854, -0.45956886117628726]\n", + " B: [-1.55277617510909, -0.23319042207457166, 1.041131562383322, 0.522284545863997]\n", + " B: [-1.5392850154950812, -0.17146823428497893, 0.5423312713893238, -1.022679713122405]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [8.96392902704659, 0.0, 0.0, 8.907975280720553]\n", - " A: [8.96392902704659, 0.0, 0.0, -8.907975280720553]\n", + " 2 Incoming particles:\n", + " A: [6.965556009635571, 0.0, 0.0, 6.8934005050751415]\n", + " B: [6.965556009635571, 0.0, 0.0, -6.8934005050751415]\n", " 8 Outgoing Particles:\n", - " B: [-2.3893793434010293, -0.14541908941249562, 1.1744750611669779, -1.8189544430256628]\n", - " B: [-2.0802027977001645, 1.683798894576558, 0.41465308743706897, 0.5657983556544335]\n", - " B: [-2.8021551416275847, -0.8730063299537363, 0.6172249959287677, 2.3893444059011983]\n", - " B: [-1.282870124595495, -0.1317177386142356, -0.27025705867504474, -0.7452297069698219]\n", - " B: [-1.8960716643333162, -0.7036305697937141, 1.4218891176648742, 0.27968395485921654]\n", - " B: [-1.0488989026854814, -0.26010877348210254, 0.17797714106142565, 0.02926553044188003]\n", - " B: [-2.389710780404753, -0.7265445366908958, -0.8235444674133567, 1.8720644113865725]\n", - " A: [-4.038569299345353, 1.1566281433706218, -2.7124178771707133, -2.5719725082478164]\n", + " A: [-1.0775179795487104, -0.05690318568456522, -0.2919638065794134, 0.269377354945329]\n", + " B: [-3.216279237662679, -2.600571207682032, 0.23217633942174215, 1.5898351096286563]\n", + " B: [-1.9852997763312183, 1.2696870590322706, -0.6412445999499571, -0.9581833525279955]\n", + " B: [-1.9885313318262752, 0.8019078287339996, 1.2060162608136897, 0.9255946577864792]\n", + " B: [-1.4288503016026572, 0.2805632486843285, 0.07929023042776773, -0.9780646743628009]\n", + " B: [-1.3652585458391595, -0.12810083240879516, 0.7809145290728301, -0.4875382774777694]\n", + " B: [-1.8158888731893035, 0.7439741257624499, -1.2924797037897653, -0.2710186621991885]\n", + " B: [-1.0534859732711408, -0.3105570364376559, -0.07270924941689365, -0.0900021557927108]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [9.51582153132561, 0.0, 0.0, 9.463131586110388]\n", - " A: [9.51582153132561, 0.0, 0.0, -9.463131586110388]\n", + " 2 Incoming particles:\n", + " A: [6.43062328219917, 0.0, 0.0, 6.352394493225528]\n", + " B: [6.43062328219917, 0.0, 0.0, -6.352394493225528]\n", " 8 Outgoing Particles:\n", - " B: [-2.198860075158402, -0.42521433364826555, 0.002989971532631837, -1.9115882037342424]\n", - " B: [-3.164412600828866, -2.892224355353346, 0.7367385818980625, 0.32521016055507507]\n", - " B: [-2.3813179922199987, -0.506545178582416, 0.7108442645181019, 1.9770654500363183]\n", - " B: [-1.9538700209386655, -0.8618707380363797, 1.186000681720045, -0.8174284510579963]\n", - " B: [-3.371884539662021, 2.8395690061431638, 1.4581158121389344, -0.42467809756720504]\n", - " B: [-2.6593380883580546, 0.8931649323333468, -2.091082202154905, 0.9495844858004108]\n", - " B: [-1.1300723243009745, -0.16527807657001936, -0.4394099238200392, -0.2380452360472458]\n", - " A: [-2.1718874211842363, 1.1183987437139151, -1.5641971858328316, 0.13987989201488576]\n", + " A: [-2.125364788369443, -1.214725294501684, 0.4075454777366224, 1.369497946736289]\n", + " B: [-1.1032249572940587, -0.2977536437640783, 0.35819035202044425, 0.012155070594697458]\n", + " B: [-2.225917349319406, 1.3039585629995813, -0.8668848261688078, 1.2259326287114942]\n", + " B: [-2.717025897056506, -0.9721840017189309, 0.6274004665152297, -2.2457641565164295]\n", + " B: [-1.000557419196324, 0.013685057618434337, 0.015873673340379625, 0.025997976872664537]\n", + " B: [-1.1652637249339481, 0.20750251779397902, -0.05219673300317853, -0.5586212982154317]\n", + " B: [-1.4667402310584912, 0.9160649085291783, -0.533306342231441, -0.16654228923208916]\n", + " B: [-1.057152197170161, 0.043451893043520345, 0.0433779317907512, 0.3373441210488047]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [6.357743380256554, 0.0, 0.0, 6.278606604111778]\n", - " A: [6.357743380256554, 0.0, 0.0, -6.278606604111778]\n", + " 2 Incoming particles:\n", + " A: [8.156196486154876, 0.0, 0.0, 8.094661272762755]\n", + " B: [8.156196486154876, 0.0, 0.0, -8.094661272762755]\n", " 8 Outgoing Particles:\n", - " B: [-1.4137331879075177, -0.233323462534503, -0.48124156481430536, 0.8441612670083491]\n", - " B: [-2.6870961992411644, 2.4029040091317038, 0.5082900029119076, -0.43379670332415793]\n", - " B: [-1.4075987059037833, -0.39813856207735293, 0.8806743446562326, 0.21733039574182572]\n", - " B: [-1.952172579900526, -0.5278337652432512, 0.07149668911634006, -1.5897350475566703]\n", - " B: [-1.2349347923179552, 0.04506793000664283, -0.5214490376206476, -0.5011224642009255]\n", - " B: [-1.1165758258836163, 0.02086820074549926, -0.43701016167280243, 0.23521949693857516]\n", - " B: [-1.2905637143198243, -0.6819933176862016, -0.4018578571749612, 0.19735774111267287]\n", - " A: [-1.612811755038721, -0.627551032342536, 0.3810975845982358, 1.0305853142803303]\n", + " A: [-1.4617318374080812, 0.10404421660552193, -0.19476289320497314, -1.0430254938944576]\n", + " B: [-2.745518719911882, 2.0283487429720055, -0.01415841484271091, -1.556751090431481]\n", + " B: [-1.193795120882441, -0.223211890483827, 0.20666745479885903, 0.5767250694363129]\n", + " B: [-1.0771186742980503, 0.29121400254582763, -0.18584437613704033, 0.20209134345899718]\n", + " B: [-2.9756813564276348, 0.7747616688600099, 0.31071107817153876, 2.6754219325851647]\n", + " B: [-1.8605025819101852, -0.3441559100391822, 0.5570133470539003, 1.4257498722017754]\n", + " B: [-3.3546424693401353, -1.4228183303706836, -0.7768040014609222, -2.7614832317390525]\n", + " B: [-1.6434022121313414, -1.2081825000896715, 0.0971778056213486, 0.48127159838273986]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [6.130345720289975, 0.0, 0.0, 6.048234341547756]\n", - " A: [6.130345720289975, 0.0, 0.0, -6.048234341547756]\n", + " 2 Incoming particles:\n", + " A: [9.631814348202784, 0.0, 0.0, 9.579762399884718]\n", + " B: [9.631814348202784, 0.0, 0.0, -9.579762399884718]\n", " 8 Outgoing Particles:\n", - " B: [-1.4326072521483875, -0.2772762950504434, -0.24466877320483055, 0.956879609214083]\n", - " B: [-1.5776360936332103, -0.2583249349585627, -0.4255133253556846, 1.1140656541953249]\n", - " B: [-1.0147620530760844, 0.13949346024875797, -0.08328820868034556, 0.05785043825103748]\n", - " B: [-1.293580660025528, 0.6852335955973128, 0.3975970785880869, 0.21382798356407548]\n", - " B: [-1.2976287195107719, 0.15887464753799807, 0.782036259346533, -0.21683733335411753]\n", - " B: [-1.7761624248601753, 0.7276287341291825, -1.2726314820020064, -0.07562073638968408]\n", - " B: [-2.590056806381479, -0.3973282137195602, 0.9895073267790887, -2.1380832072480156]\n", - " A: [-1.2782574309443122, -0.7783009937846852, -0.1430388754708429, 0.08791759176729656]\n", + " A: [-2.4271747113709625, -0.9216752449526319, 0.35006248470601437, 1.9796838331313595]\n", + " B: [-1.926574191117535, -0.6155920425308834, -0.36855158619622796, 1.4821957628346814]\n", + " B: [-2.809711053334662, 0.053095841327541846, -2.415282611989454, -1.0286238083410733]\n", + " B: [-2.069340346061984, 0.0706218659128716, 1.6880494984307581, 0.6539655271821153]\n", + " B: [-1.600891859223819, 0.522182956459051, 1.0136801062226364, -0.5124766796267364]\n", + " B: [-2.3653602811566903, 0.7359929823506941, 2.003935313635875, 0.19361520696286152]\n", + " B: [-4.134587420071929, 0.11270979705086029, -1.0448676862999513, -3.871738776569513]\n", + " B: [-1.9299888340679847, 0.04266384438249662, -1.2270255185096508, 1.1033789344263045]\n", "\n", " Input for ABC Process: 'AB->ABBBBBBB':\n", - " 2 Ingoing particles:\n", - " B: [5.614031384111412, 0.0, 0.0, 5.524250933998916]\n", - " A: [5.614031384111412, 0.0, 0.0, -5.524250933998916]\n", + " 2 Incoming particles:\n", + " A: [7.383091586636561, 0.0, 0.0, 7.31505580133628]\n", + " B: [7.383091586636561, 0.0, 0.0, -7.31505580133628]\n", " 8 Outgoing Particles:\n", - " B: [-1.1975327132078701, -0.1893270691431532, 0.6301793280237195, 0.03337476028738165]\n", - " B: [-1.8780203352470435, 0.3804442998242718, -0.6924590977588293, 1.3793922256789994]\n", - " B: [-2.0692007193909774, -1.0383662307089536, 1.010356939895161, -1.0874585242928134]\n", - " B: [-1.1162504316135156, 0.02668980907078698, -0.42171590435133693, 0.25972750371544917]\n", - " B: [-1.0629241444846567, -0.12121334536781084, 0.29190610487423235, 0.17293318874737984]\n", - " B: [-1.0164452123103798, 0.1408149996539992, 0.012518491824283254, -0.11478367855920323]\n", - " B: [-1.4812661461667407, 0.7469275648138908, 0.14658769496490245, -0.7840667423030614]\n", - " A: [-1.4064230658016392, 0.05402997185696898, -0.9773735574721323, 0.14088126672586804]\n" + " A: [-1.0026822379766207, 0.02425303574920085, -0.0683120173174935, 0.010813366763733786]\n", + " B: [-3.2851307251831745, -2.830568076855887, -0.9156122597784988, 0.9703723169846757]\n", + " B: [-2.028220232462834, 1.6810294384373135, 0.4923274291375999, -0.21314558638988076]\n", + " B: [-1.5191535227395792, -0.17123543395193966, -1.1293131485074372, -0.05619309939470401]\n", + " B: [-1.1059696544762567, 0.2375361941082015, -0.40208228112542477, -0.07124094550113935]\n", + " B: [-1.371740281577803, -0.2278482692103191, -0.6986437390927988, -0.5845113276468179]\n", + " B: [-1.2867512190171768, 0.6015837296464805, -0.16735271525316733, -0.5155761675681034]\n", + " B: [-3.166535299839676, 0.6852493820769491, 2.888988731937221, 0.4594814427522358]\n" ] }, - "execution_count": 5, + "execution_count": 7, "metadata": {}, "output_type": "execute_result" } @@ -478,9 +490,163 @@ }, { "cell_type": "code", - "execution_count": null, + "execution_count": 8, "metadata": {}, - "outputs": [], + "outputs": [ + { + "name": "stderr", + "output_type": "stream", + "text": [ + "Internal error: stack overflow in type inference of materialize(Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1}, Nothing, typeof(MetagraphOptimization.compute__8fd7c454_6214_11ee_3616_0f2435e477fe), Tuple{Array{MetagraphOptimization.ABCProcessInput, 1}}}).\n", + "This might be caused by recursion over very long tuples or argument lists.\n" + ] + }, + { + "ename": "LoadError", + "evalue": "StackOverflowError:", + "output_type": "error", + "traceback": [ + "StackOverflowError:", + "", + "Stacktrace:", + " [1] get", + " @ ./iddict.jl:102 [inlined]", + " [2] in", + " @ ./iddict.jl:189 [inlined]", + " [3] haskey", + " @ ./abstractdict.jl:17 [inlined]", + " [4] findall(sig::Type, table::Core.Compiler.CachedMethodTable{Core.Compiler.InternalMethodTable}; limit::Int64)", + " @ Core.Compiler ./compiler/methodtable.jl:120", + " [5] findall", + " @ ./compiler/methodtable.jl:114 [inlined]", + " [6] find_matching_methods(argtypes::Vector{Any}, atype::Any, method_table::Core.Compiler.CachedMethodTable{Core.Compiler.InternalMethodTable}, union_split::Int64, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:336", + " [7] abstract_call_gf_by_type(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, atype::Any, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:80", + " [8] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1949", + " [9] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2020", + " [10] abstract_apply(interp::Core.Compiler.NativeInterpreter, argtypes::Vector{Any}, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1566", + " [11] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1855", + " [12] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Nothing)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2020", + " [13] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1999", + " [14] abstract_eval_statement_expr(interp::Core.Compiler.NativeInterpreter, e::Expr, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState, mi::Nothing)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2183", + " [15] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2396", + " [16] abstract_eval_basic_statement(interp::Core.Compiler.NativeInterpreter, stmt::Any, pc_vartable::Vector{Core.Compiler.VarState}, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2682", + " [17] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2867", + " [18] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2955", + " [19] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:246", + " [20] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:216", + " [21] typeinf_edge(interp::Core.Compiler.NativeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector, caller::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:932", + " [22] abstract_call_method(interp::Core.Compiler.NativeInterpreter, method::Method, sig::Any, sparams::Core.SimpleVector, hardlimit::Bool, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:611", + " [23] abstract_call_gf_by_type(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, atype::Any, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:152", + "--- the last 16 lines are repeated 413 more times ---", + " [6632] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1949", + " [6633] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2020", + " [6634] abstract_apply(interp::Core.Compiler.NativeInterpreter, argtypes::Vector{Any}, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1566", + " [6635] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1855", + " [6636] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Nothing)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2020", + " [6637] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1999", + " [6638] abstract_eval_statement_expr(interp::Core.Compiler.NativeInterpreter, e::Expr, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState, mi::Nothing)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2183", + " [6639] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2396", + " [6640] abstract_eval_basic_statement(interp::Core.Compiler.NativeInterpreter, stmt::Any, pc_vartable::Vector{Core.Compiler.VarState}, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2658", + " [6641] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2867", + " [6642] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2955", + " [6643] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:246", + " [6644] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:216", + " [6645] typeinf_edge(interp::Core.Compiler.NativeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector, caller::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:932", + " [6646] abstract_call_method(interp::Core.Compiler.NativeInterpreter, method::Method, sig::Any, sparams::Core.SimpleVector, hardlimit::Bool, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:611", + " [6647] abstract_call_gf_by_type(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, atype::Any, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:152", + " [6648] abstract_call_known(interp::Core.Compiler.NativeInterpreter, f::Any, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Int64)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1949", + " [6649] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState, max_methods::Nothing)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2020", + " [6650] abstract_call(interp::Core.Compiler.NativeInterpreter, arginfo::Core.Compiler.ArgInfo, si::Core.Compiler.StmtInfo, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:1999", + " [6651] abstract_eval_statement_expr(interp::Core.Compiler.NativeInterpreter, e::Expr, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState, mi::Nothing)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2183", + " [6652] abstract_eval_statement(interp::Core.Compiler.NativeInterpreter, e::Any, vtypes::Vector{Core.Compiler.VarState}, sv::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2396", + " [6653] abstract_eval_basic_statement(interp::Core.Compiler.NativeInterpreter, stmt::Any, pc_vartable::Vector{Core.Compiler.VarState}, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2682", + " [6654] typeinf_local(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2867", + " [6655] typeinf_nocycle(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/abstractinterpretation.jl:2955", + " [6656] _typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:246", + " [6657] typeinf(interp::Core.Compiler.NativeInterpreter, frame::Core.Compiler.InferenceState)", + " @ Core.Compiler ./compiler/typeinfer.jl:216", + " [6658] typeinf", + " @ ./compiler/typeinfer.jl:12 [inlined]", + " [6659] typeinf_type(interp::Core.Compiler.NativeInterpreter, method::Method, atype::Any, sparams::Core.SimpleVector)", + " @ Core.Compiler ./compiler/typeinfer.jl:1079", + " [6660] return_type(interp::Core.Compiler.NativeInterpreter, t::DataType)", + " @ Core.Compiler ./compiler/typeinfer.jl:1140", + " [6661] return_type(f::Any, t::DataType)", + " @ Core.Compiler ./compiler/typeinfer.jl:1112", + " [6662] combine_eltypes(f::Function, args::Tuple{Vector{ABCProcessInput}})", + " @ Base.Broadcast ./broadcast.jl:730", + " [6663] copy(bc::Base.Broadcast.Broadcasted{Style}) where Style", + " @ Base.Broadcast ./broadcast.jl:895", + " [6664] materialize(bc::Base.Broadcast.Broadcasted)", + " @ Base.Broadcast ./broadcast.jl:873", + " [6665] var\"##core#293\"()", + " @ Main ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:489", + " [6666] var\"##sample#294\"(::Tuple{}, __params::BenchmarkTools.Parameters)", + " @ Main ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:495", + " [6667] _run(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters; verbose::Bool, pad::String, kwargs::Base.Pairs{Symbol, Integer, NTuple{4, Symbol}, NamedTuple{(:samples, :evals, :gctrial, :gcsample), Tuple{Int64, Int64, Bool, Bool}}})", + " @ BenchmarkTools ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:99", + " [6668] #invokelatest#2", + " @ ./essentials.jl:821 [inlined]", + " [6669] invokelatest", + " @ ./essentials.jl:816 [inlined]", + " [6670] #run_result#45", + " @ ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:34 [inlined]", + " [6671] run_result", + " @ ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:34 [inlined]", + " [6672] run(b::BenchmarkTools.Benchmark, p::BenchmarkTools.Parameters; progressid::Nothing, nleaves::Float64, ndone::Float64, kwargs::Base.Pairs{Symbol, Integer, NTuple{5, Symbol}, NamedTuple{(:verbose, :samples, :evals, :gctrial, :gcsample), Tuple{Bool, Int64, Int64, Bool, Bool}}})", + " @ BenchmarkTools ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:117", + " [6673] run (repeats 2 times)", + " @ ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:117 [inlined]", + " [6674] #warmup#54", + " @ ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:169 [inlined]", + " [6675] warmup(item::BenchmarkTools.Benchmark)", + " @ BenchmarkTools ~/.julia/packages/BenchmarkTools/0owsb/src/execution.jl:168" + ] + } + ], "source": [ "using BenchmarkTools\n", "@benchmark compute_AB_AB7.(inputs)" diff --git a/notebooks/abc_model_showcase.ipynb b/notebooks/abc_model_showcase.ipynb index 5aa690b..cd72498 100644 --- a/notebooks/abc_model_showcase.ipynb +++ b/notebooks/abc_model_showcase.ipynb @@ -2,20 +2,10 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, + "execution_count": 2, "id": "20768e45-df62-4638-ba33-b0ccf239f1aa", "metadata": {}, - "outputs": [ - { - "name": "stderr", - "output_type": "stream", - "text": [ - "┌ Error: Failed to initialize oneAPI\n", - "│ exception = (oneAPI.oneL0.ZeError(oneAPI.oneL0.ZE_RESULT_ERROR_UNINITIALIZED), Union{Ptr{Nothing}, Base.InterpreterIP}[Ptr{Nothing} @0x00007f1860405f02, Ptr{Nothing} @0x00007f18604068dc, Ptr{Nothing} @0x00007f1860406900, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f1967e7a7a4, Ptr{Nothing} @0x00007f1967e5e3bc, Ptr{Nothing} @0x00007f1953cecc65, Ptr{Nothing} @0x00007f19480c5c72, Ptr{Nothing} @0x00007f19480cb52c, Ptr{Nothing} @0x00007f19480c79a6, Ptr{Nothing} @0x00007f19480f67de, Ptr{Nothing} @0x00007f19480f6b4d, Ptr{Nothing} @0x00007f19480d2439, Ptr{Nothing} @0x00007f19480d40e4, Ptr{Nothing} @0x00007f19480d4286, Ptr{Nothing} @0x00007f19480d0c2a, Ptr{Nothing} @0x00007f19480d1216, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f1967e7a338, Ptr{Nothing} @0x00007f1967e7c0e8, Ptr{Nothing} @0x00007f1967e7ba79, Ptr{Nothing} @0x00007f1967e7cdfa, Ptr{Nothing} @0x00007f19480f31ff, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f1967e51f48, Ptr{Nothing} @0x00007f19480f1eb9, Ptr{Nothing} @0x00007f19480f2c78, Ptr{Nothing} @0x00007f19480f2f21, Ptr{Nothing} @0x00007f19480f2f56, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f19480e8bb1, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f19480ddd7c, Ptr{Nothing} @0x00007f19480dde82, Ptr{Nothing} @0x00007f19480ddead, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f19480d5001, Ptr{Nothing} @0x00007f1967e7b5db, Ptr{Nothing} @0x00007f1967e7ba79, Ptr{Nothing} @0x00007f1967e7cdfa, Ptr{Nothing} @0x00007f1953d26667, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f1953b5abfd, Ptr{Nothing} @0x00007f19533d6e93, Ptr{Nothing} @0x00007f19533d6eaf, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f1953d5c06e, Ptr{Nothing} @0x00007f1953786d4f, Ptr{Nothing} @0x00007f1953786e58, Ptr{Nothing} @0x00007f1967e42f4d, Ptr{Nothing} @0x00007f1967ea7a15, Ptr{Nothing} @0x00007f1967ea845e, Ptr{Nothing} @0x0000000000401088, Ptr{Nothing} @0x00007f1968c27ccf, Ptr{Nothing} @0x00007f1968c27d89, Ptr{Nothing} @0x00000000004010b8])\n", - "└ @ oneAPI.oneL0 /home/antonr/.julia/packages/oneAPI/g8ZUm/lib/level-zero/oneL0.jl:103\n" - ] - } - ], + "outputs": [], "source": [ "using Revise\n", "using MetagraphOptimization\n", @@ -24,18 +14,27 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 3, "id": "ff5f4a49", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Found 1 NUMA nodes\n", + "CUDA is non-functional\n" + ] + }, { "data": { "text/plain": [ - "Machine(MetagraphOptimization.AbstractDevice[MetagraphOptimization.NumaNode(0x0000, 0x0001, -1.0)], [-1.0;;])" + "Machine(MetagraphOptimization.AbstractDevice[MetagraphOptimization.NumaNode(0x0000, 0x0001, MetagraphOptimization.LocalVariables(), -1.0, UUID(\"a89974f6-6212-11ee-0866-0f591a3b69ea\"))], [-1.0;;])" ] }, + "execution_count": 3, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -45,7 +44,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 4, "id": "9df482a4-ca44-44c5-9ea7-7a2977d529be", "metadata": {}, "outputs": [ @@ -55,8 +54,9 @@ "ABCModel()" ] }, + "execution_count": 4, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -66,7 +66,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 5, "id": "30b16872-07f7-4d47-8ff8-8c3a849c9d4e", "metadata": {}, "outputs": [ @@ -76,8 +76,9 @@ "ABC Process: 'AB->ABBB'" ] }, + "execution_count": 5, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -88,10 +89,17 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 6, "id": "043bd9e2-f89a-4362-885a-8c89d4cdd76f", "metadata": {}, "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Total: 280, ComputeTaskP" + ] + }, { "data": { "text/plain": [ @@ -103,16 +111,17 @@ " Total Compute Intensity: 0.09822733918128655\n" ] }, + "execution_count": 6, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" }, { "name": "stdout", "output_type": "stream", "text": [ - "Total: 280, DataTask: 143, ComputeTaskV: 64, \n", - " ComputeTaskS2: 24, ComputeTaskS1: 36, ComputeTaskP: 6, \n", - " ComputeTaskSum: 1, ComputeTaskU: 6" + ": 6, ComputeTaskU: 6, \n", + " ComputeTaskV: 64, ComputeTaskSum: 1, ComputeTaskS2: 24, \n", + " ComputeTaskS1: 36, DataTask: 143" ] } ], @@ -123,7 +132,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 7, "id": "02f01ad3-fd10-48d5-a0e0-c03dc83c80a4", "metadata": {}, "outputs": [ @@ -132,17 +141,18 @@ "text/plain": [ "Input for ABC Process: 'AB->ABBB':\n", " 2 Incoming particles:\n", - " B: [3.6884461652243594, 0.0, 0.0, 3.5503007075117288]\n", - " A: [3.6884461652243594, 0.0, 0.0, -3.5503007075117288]\n", + " A: [5.77986599979293, 0.0, 0.0, 5.692701553354288]\n", + " B: [5.77986599979293, 0.0, 0.0, -5.692701553354288]\n", " 4 Outgoing Particles:\n", - " B: [-2.1242475430909664, -0.8503576743556215, -0.7677870655372816, 1.4831798515305399]\n", - " B: [-1.7067195416668486, 1.3493031523092422, -0.2241887179000338, 0.20496832887590027]\n", - " B: [-2.276483767911827, 0.19358394881362065, 1.325763825770123, -1.5450740689711668]\n", - " A: [-1.2694414777790763, -0.6925294267672414, -0.3337880423328074, -0.14307411143527338]\n" + " A: [-3.8835293143673746, -1.4292027910861678, 2.8576090179942106, 1.968057422378813]\n", + " B: [-1.1554024905063585, -0.1464656500147254, -0.2082400426692148, 0.5197487980391896]\n", + " B: [-2.849749730594798, -1.0177034035100576, -2.464951858896686, -0.09677625137882176]\n", + " B: [-3.6710504641173287, 2.5933718446109513, -0.1844171164283155, -2.391029969039186]\n" ] }, + "execution_count": 7, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -152,18 +162,19 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 8, "id": "083fb1be-ce2a-47f9-afb9-60a6fdfaed0b", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "compute_2430665c_5ee0_11ee_1bd6_cf00927a1f40 (generic function with 1 method)" + "compute__af4450a2_6212_11ee_2601_cde7cf2aedc1 (generic function with 1 method)" ] }, + "execution_count": 8, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -173,18 +184,19 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 9, "id": "a40c9500-8f79-4f04-b3c5-59b72a6b7ba9", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "-1.0304553507713216e-11" + "-1.8924431710735022e-13" ] }, + "execution_count": 9, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -194,7 +206,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 10, "id": "80c70010", "metadata": {}, "outputs": [], @@ -207,7 +219,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 11, "id": "5b192b44", "metadata": {}, "outputs": [], @@ -218,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 12, "id": "9b2f4a3f", "metadata": {}, "outputs": [ @@ -226,30 +238,37 @@ "data": { "text/plain": [ "1000-element Vector{Float64}:\n", - " -2.1503212387420805e-13\n", - " -3.515624153345333e-15\n", - " -9.952937612602425e-14\n", - " -9.153444987973305e-14\n", - " -9.219799628850346e-12\n", - " -1.0155811880772751e-13\n", - " -2.278823085449527e-13\n", - " -8.070463578419918e-14\n", - " -1.838772437827446e-13\n", - " -4.109239393253953e-12\n", + " -2.1491995259940396e-11\n", + " -1.04995646459455e-11\n", + " 5.821760691187782e-15\n", + " -6.556969485683705e-14\n", + " -1.3588086164373753e-14\n", + " -1.8789662441593694e-13\n", + " -2.131973301835892e-13\n", + " -5.3359759072004825e-12\n", + " -9.053914191490223e-13\n", + " -5.61107901706923e-13\n", + " -5.063492275603428e-11\n", + " 2.9168508985811397e-15\n", + " -1.6420151378194157e-13\n", " ⋮\n", - " -9.249672758783865e-13\n", - " -1.1230011623854415e-11\n", - " 3.0412717788587913e-12\n", - " -7.618572966754196e-12\n", - " -1.771698295445229e-14\n", - " -3.128112746753292e-11\n", - " -3.9791519593567145e-12\n", - " -4.4850922847751944e-15\n", - " 1.0995512644879932e-14" + " 1.0931677247833436e-13\n", + " -7.704755306462797e-16\n", + " -1.8385907037491397e-12\n", + " -6.036215596560059e-14\n", + " -9.98872401400362e-12\n", + " 3.4861755637292935e-13\n", + " -1.1051119822969222e-10\n", + " -2.496572513216201e-12\n", + " -3.8682427847201926e-11\n", + " 7.904149696653438e-15\n", + " -7.606811743178716e-11\n", + " -5.100594937480292e-13" ] }, + "execution_count": 12, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -262,27 +281,28 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 13, "id": "d43e4ff0", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "BenchmarkTools.Trial: 1366 samples with 1 evaluation.\n", - " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m2.671 ms\u001b[22m\u001b[39m … \u001b[35m9.612 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m 0.00% … 44.01%\n", - " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m3.007 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m 0.00%\n", - " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m3.654 ms\u001b[22m\u001b[39m ± \u001b[32m1.320 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m11.60% ± 16.57%\n", + "BenchmarkTools.Trial: 879 samples with 1 evaluation.\n", + " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m4.567 ms\u001b[22m\u001b[39m … \u001b[35m14.334 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m0.00% … 54.51%\n", + " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m4.998 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m0.00%\n", + " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m5.686 ms\u001b[22m\u001b[39m ± \u001b[32m 1.414 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m9.09% ± 14.49%\n", "\n", - " \u001b[39m▅\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m▆\u001b[39m▄\u001b[39m▃\u001b[39m▁\u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\n", - " \u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[32m▇\u001b[39m\u001b[39m█\u001b[39m▇\u001b[39m▆\u001b[39m▇\u001b[39m▇\u001b[39m█\u001b[39m▇\u001b[39m▇\u001b[39m▆\u001b[39m▇\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▆\u001b[39m▆\u001b[39m▄\u001b[39m▄\u001b[39m▅\u001b[39m▄\u001b[39m▁\u001b[39m▅\u001b[39m▆\u001b[39m▄\u001b[39m▆\u001b[39m▅\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▅\u001b[39m \u001b[39m█\n", - " 2.67 ms\u001b[90m \u001b[39m\u001b[90mHistogram: \u001b[39m\u001b[90m\u001b[1mlog(\u001b[22m\u001b[39m\u001b[90mfrequency\u001b[39m\u001b[90m\u001b[1m)\u001b[22m\u001b[39m\u001b[90m by time\u001b[39m 8.27 ms \u001b[0m\u001b[1m<\u001b[22m\n", + " \u001b[39m \u001b[39m \u001b[39m▃\u001b[39m▇\u001b[39m█\u001b[34m▅\u001b[39m\u001b[39m▄\u001b[39m▁\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n", + " \u001b[39m▆\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m▇\u001b[39m▇\u001b[32m█\u001b[39m\u001b[39m▆\u001b[39m█\u001b[39m█\u001b[39m▆\u001b[39m▆\u001b[39m▇\u001b[39m▅\u001b[39m▅\u001b[39m▄\u001b[39m▁\u001b[39m▄\u001b[39m▅\u001b[39m▅\u001b[39m▆\u001b[39m▅\u001b[39m▅\u001b[39m▄\u001b[39m▁\u001b[39m▄\u001b[39m▄\u001b[39m▁\u001b[39m▅\u001b[39m▄\u001b[39m▄\u001b[39m▆\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▄\u001b[39m▅\u001b[39m▆\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▁\u001b[39m▅\u001b[39m▄\u001b[39m▄\u001b[39m▅\u001b[39m▁\u001b[39m▄\u001b[39m \u001b[39m▇\n", + " 4.57 ms\u001b[90m \u001b[39m\u001b[90mHistogram: \u001b[39m\u001b[90m\u001b[1mlog(\u001b[22m\u001b[39m\u001b[90mfrequency\u001b[39m\u001b[90m\u001b[1m)\u001b[22m\u001b[39m\u001b[90m by time\u001b[39m 10 ms \u001b[0m\u001b[1m<\u001b[22m\n", "\n", - " Memory estimate\u001b[90m: \u001b[39m\u001b[33m6.17 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m143004\u001b[39m." + " Memory estimate\u001b[90m: \u001b[39m\u001b[33m6.17 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m143006\u001b[39m." ] }, + "execution_count": 13, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ @@ -291,32 +311,84 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 14, "id": "e18d9546", "metadata": {}, "outputs": [ { "data": { "text/plain": [ - "BenchmarkTools.Trial: 1772 samples with 1 evaluation.\n", - " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m2.065 ms\u001b[22m\u001b[39m … \u001b[35m8.468 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m 0.00% … 44.06%\n", - " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m2.158 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m 0.00%\n", - " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m2.820 ms\u001b[22m\u001b[39m ± \u001b[32m1.195 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m11.39% ± 16.96%\n", + "BenchmarkTools.Trial: 1089 samples with 1 evaluation.\n", + " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m3.637 ms\u001b[22m\u001b[39m … \u001b[35m10.921 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m 0.00% … 59.52%\n", + " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m4.098 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m 0.00%\n", + " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m4.587 ms\u001b[22m\u001b[39m ± \u001b[32m 1.334 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m10.21% ± 15.77%\n", "\n", - " \u001b[39m█\u001b[34m▆\u001b[39m\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n", - " \u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m▇\u001b[39m▆\u001b[39m▇\u001b[39m▇\u001b[39m▆\u001b[32m▅\u001b[39m\u001b[39m▆\u001b[39m▆\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▆\u001b[39m▄\u001b[39m▆\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▆\u001b[39m▆\u001b[39m▁\u001b[39m▅\u001b[39m▃\u001b[39m▃\u001b[39m▅\u001b[39m▆\u001b[39m▄\u001b[39m▄\u001b[39m▄\u001b[39m▁\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▁\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▆\u001b[39m \u001b[39m█\n", - " 2.06 ms\u001b[90m \u001b[39m\u001b[90mHistogram: \u001b[39m\u001b[90m\u001b[1mlog(\u001b[22m\u001b[39m\u001b[90mfrequency\u001b[39m\u001b[90m\u001b[1m)\u001b[22m\u001b[39m\u001b[90m by time\u001b[39m 7.41 ms \u001b[0m\u001b[1m<\u001b[22m\n", + " \u001b[39m \u001b[39m▂\u001b[39m▆\u001b[39m▆\u001b[39m▇\u001b[34m█\u001b[39m\u001b[39m▆\u001b[39m▂\u001b[39m \u001b[39m \u001b[39m \u001b[32m \u001b[39m\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m▁\u001b[39m▁\u001b[39m \u001b[39m▁\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n", + " \u001b[39m▆\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m▇\u001b[32m▆\u001b[39m\u001b[39m▅\u001b[39m▇\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▄\u001b[39m▆\u001b[39m▄\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▅\u001b[39m▆\u001b[39m▄\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▁\u001b[39m▄\u001b[39m▆\u001b[39m▆\u001b[39m▆\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m█\u001b[39m█\u001b[39m▆\u001b[39m▆\u001b[39m▆\u001b[39m█\u001b[39m█\u001b[39m▇\u001b[39m▆\u001b[39m▄\u001b[39m▄\u001b[39m \u001b[39m█\n", + " 3.64 ms\u001b[90m \u001b[39m\u001b[90mHistogram: \u001b[39m\u001b[90m\u001b[1mlog(\u001b[22m\u001b[39m\u001b[90mfrequency\u001b[39m\u001b[90m\u001b[1m)\u001b[22m\u001b[39m\u001b[90m by time\u001b[39m 8.78 ms \u001b[0m\u001b[1m<\u001b[22m\n", "\n", - " Memory estimate\u001b[90m: \u001b[39m\u001b[33m5.26 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m123004\u001b[39m." + " Memory estimate\u001b[90m: \u001b[39m\u001b[33m5.26 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m123006\u001b[39m." ] }, + "execution_count": 14, "metadata": {}, - "output_type": "display_data" + "output_type": "execute_result" } ], "source": [ "@benchmark results = AB_AB3_reduced_compute.($inputs)" ] + }, + { + "cell_type": "code", + "execution_count": 16, + "id": "13efed12-3547-400b-a7a2-5dfae9a973a2", + "metadata": {}, + "outputs": [], + "source": [ + "# Set a different caching strategy\n", + "MetagraphOptimization.set_cache_strategy(machine.devices[1], MetagraphOptimization.Dictionary())" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "id": "ef62716b-a219-4f6e-9150-f984d3734839", + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "BenchmarkTools.Trial: 331 samples with 1 evaluation.\n", + " Range \u001b[90m(\u001b[39m\u001b[36m\u001b[1mmin\u001b[22m\u001b[39m … \u001b[35mmax\u001b[39m\u001b[90m): \u001b[39m\u001b[36m\u001b[1m12.148 ms\u001b[22m\u001b[39m … \u001b[35m24.164 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmin … max\u001b[90m): \u001b[39m 0.00% … 13.35%\n", + " Time \u001b[90m(\u001b[39m\u001b[34m\u001b[1mmedian\u001b[22m\u001b[39m\u001b[90m): \u001b[39m\u001b[34m\u001b[1m15.412 ms \u001b[22m\u001b[39m\u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmedian\u001b[90m): \u001b[39m17.47%\n", + " Time \u001b[90m(\u001b[39m\u001b[32m\u001b[1mmean\u001b[22m\u001b[39m ± \u001b[32mσ\u001b[39m\u001b[90m): \u001b[39m\u001b[32m\u001b[1m15.117 ms\u001b[22m\u001b[39m ± \u001b[32m 2.194 ms\u001b[39m \u001b[90m┊\u001b[39m GC \u001b[90m(\u001b[39mmean ± σ\u001b[90m): \u001b[39m12.31% ± 8.95%\n", + "\n", + " \u001b[39m \u001b[39m▄\u001b[39m█\u001b[39m▄\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[32m▄\u001b[39m\u001b[39m▄\u001b[34m▂\u001b[39m\u001b[39m \u001b[39m▂\u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \u001b[39m \n", + " \u001b[39m▅\u001b[39m█\u001b[39m█\u001b[39m█\u001b[39m▅\u001b[39m▃\u001b[39m▃\u001b[39m▂\u001b[39m▃\u001b[39m▂\u001b[39m▅\u001b[39m▂\u001b[39m▃\u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▂\u001b[39m▃\u001b[39m▂\u001b[39m▃\u001b[32m█\u001b[39m\u001b[39m█\u001b[34m█\u001b[39m\u001b[39m▇\u001b[39m█\u001b[39m▄\u001b[39m▆\u001b[39m▄\u001b[39m▆\u001b[39m▄\u001b[39m▄\u001b[39m▆\u001b[39m▅\u001b[39m▄\u001b[39m▃\u001b[39m▄\u001b[39m▂\u001b[39m▂\u001b[39m▃\u001b[39m▃\u001b[39m▄\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▂\u001b[39m▂\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▂\u001b[39m▁\u001b[39m▃\u001b[39m▃\u001b[39m▂\u001b[39m▂\u001b[39m▁\u001b[39m▂\u001b[39m \u001b[39m▃\n", + " 12.1 ms\u001b[90m Histogram: frequency by time\u001b[39m 21 ms \u001b[0m\u001b[1m<\u001b[22m\n", + "\n", + " Memory estimate\u001b[90m: \u001b[39m\u001b[33m27.46 MiB\u001b[39m, allocs estimate\u001b[90m: \u001b[39m\u001b[33m118013\u001b[39m." + ] + }, + "execution_count": 18, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "# ... and bench again\n", + "AB_AB3_reduced_dict_compute = get_compute_function(graph, process, machine)\n", + "@benchmark results = AB_AB3_reduced_dict_compute.($inputs)" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5461ffd4-6a0e-4f1f-b1f1-3a2854a8ae88", + "metadata": {}, + "outputs": [], + "source": [] } ], "metadata": { diff --git a/src/code_gen/main.jl b/src/code_gen/main.jl index c1b2ade..25d0736 100644 --- a/src/code_gen/main.jl +++ b/src/code_gen/main.jl @@ -12,9 +12,6 @@ Generate the code for a given graph. The return value is a named tuple of: See also: [`execute`](@ref) """ function gen_code(graph::DAG, machine::Machine) - code = Vector{Expr}() - sizehint!(code, length(graph.nodes)) - nodeQueue = PriorityQueue{Node, Int}() inputSyms = Dict{String, Vector{Symbol}}() @@ -28,12 +25,16 @@ function gen_code(graph::DAG, machine::Machine) push!(inputSyms[node.name], Symbol("$(to_var_name(node.id))_in")) end + schedule = Vector{Node}() + sizehint!(schedule, length(graph.nodes)) + + # "scheduling" node = nothing while !isempty(nodeQueue) @assert peek(nodeQueue)[2] == 0 node = dequeue!(nodeQueue) - push!(code, get_expression(node, machine.devices[1])) + push!(schedule, node) for parent in node.parents # reduce the priority of all parents by one if (!haskey(nodeQueue, parent)) @@ -44,16 +45,27 @@ function gen_code(graph::DAG, machine::Machine) end end + codeAcc = Vector{Expr}() + sizehint!(codeAcc, length(graph.nodes)) + + for node in schedule + push!(codeAcc, get_expression(node, machine.devices[1])) + end + # node is now the last node we looked at -> the output node outSym = Symbol(to_var_name(node.id)) - return (code = Expr(:block, code...), inputSymbols = inputSyms, outputSymbol = outSym) + return (code = Expr(:block, codeAcc...), inputSymbols = inputSyms, outputSymbol = outSym) end function gen_cache_init_code(machine::Machine) initializeCaches = Vector{Expr}() - return initializeCaches + for device in machine.devices + push!(initializeCaches, gen_cache_init_code(device)) + end + + return Expr(:block, initializeCaches...) end function gen_input_assignment_code( @@ -85,7 +97,7 @@ function gen_input_assignment_code( # TODO generate correct access expression # TODO how to define cahce strategies? device = machine.devices[1] - evalExpr = eval(gen_access_expr(device, cache_strategy(device), symbol)) + evalExpr = eval(gen_access_expr(device, symbol)) push!(assignInputs, Meta.parse("$(evalExpr) = ParticleValue($p, 1.0)")) end end @@ -101,6 +113,7 @@ Return a function of signature `compute_(input::AbstractProcessInput)`, whic function get_compute_function(graph::DAG, process::AbstractProcessDescription, machine::Machine) (code, inputSymbols, outputSymbol) = gen_code(graph, machine) + initCaches = gen_cache_init_code(machine) assignInputs = gen_input_assignment_code(inputSymbols, process, machine, :input) # TODO generate correct access expression @@ -108,9 +121,9 @@ function get_compute_function(graph::DAG, process::AbstractProcessDescription, m device = machine.devices[1] functionId = to_var_name(UUIDs.uuid1(rng[1])) - resSym = eval(gen_access_expr(device, cache_strategy(device), outputSymbol)) + resSym = eval(gen_access_expr(device, outputSymbol)) expr = Meta.parse( - "function compute_$(functionId)(input::AbstractProcessInput) $assignInputs; $code; return $resSym; end", + "function compute_$(functionId)(input::AbstractProcessInput) $initCaches; $assignInputs; $code; return $resSym; end", ) func = eval(expr) @@ -131,7 +144,21 @@ This is essentially shorthand for See also: [`parse_dag`](@ref), [`parse_process`](@ref), [`gen_process_input`](@ref) """ function execute(graph::DAG, process::AbstractProcessDescription, machine::Machine, input::AbstractProcessInput) - func = get_compute_function(graph, process, machine) + (code, inputSymbols, outputSymbol) = gen_code(graph, machine) + + initCaches = gen_cache_init_code(machine) + assignInputs = gen_input_assignment_code(inputSymbols, process, machine, :input) + + # TODO generate correct access expression + # TODO how to define cache strategies? + device = machine.devices[1] + + functionId = to_var_name(UUIDs.uuid1(rng[1])) + resSym = eval(gen_access_expr(device, outputSymbol)) + expr = Meta.parse( + "function compute_$(functionId)(input::AbstractProcessInput) $initCaches; $assignInputs; $code; return $resSym; end", + ) + func = eval(expr) result = 0 try @@ -139,7 +166,7 @@ function execute(graph::DAG, process::AbstractProcessDescription, machine::Machi catch e println("Error while evaluating: $e") - println("Function: $func") + println("Function:\n$expr") @assert false end diff --git a/src/devices/interface.jl b/src/devices/interface.jl index 0935c23..ca5ac33 100644 --- a/src/devices/interface.jl +++ b/src/devices/interface.jl @@ -92,7 +92,7 @@ Interface function that must be implemented for every subtype of [`AbstractDevic function measure_device! end """ - gen_cache_init_code(device::AbstractDevice, strategy::CacheStrategy) + gen_cache_init_code(device::AbstractDevice) Interface function that must be implemented for every subtype of [`AbstractDevice`](@ref) and at least one [`CacheStrategy`](@ref). Returns an `Expr` initializing this device's variable cache. @@ -101,7 +101,7 @@ The strategy is a symbol function gen_cache_init_code end """ - gen_access_expr(device::AbstractDevice, strategy::CacheStrategy, symbol::Symbol) + gen_access_expr(device::AbstractDevice, symbol::Symbol) Interface function that must be implemented for every subtype of [`AbstractDevice`](@ref) and at least one [`CacheStrategy`](@ref). Return an `Expr` or `QuoteNode` accessing the variable identified by [`symbol`]. diff --git a/src/devices/numa/impl.jl b/src/devices/numa/impl.jl index a4c1718..43e556b 100644 --- a/src/devices/numa/impl.jl +++ b/src/devices/numa/impl.jl @@ -10,6 +10,7 @@ mutable struct NumaNode <: AbstractCPU threads::UInt16 cacheStrategy::CacheStrategy FLOPS::Float64 + id::UUID end push!(DEVICE_TYPES, NumaNode) @@ -40,29 +41,44 @@ function get_devices(deviceType::Type{T}; verbose::Bool = false) where {T <: Num println("Found $(noNumaNodes + 1) NUMA nodes") end for i in 0:noNumaNodes - push!(devices, NumaNode(i, 1, default_strategy(NumaNode), -1)) + push!(devices, NumaNode(i, 1, default_strategy(NumaNode), -1, UUIDs.uuid1(rng[1]))) end return devices end """ - gen_cache_init_code(device::NumaNode, strategy::LocalVariables) + gen_cache_init_code(device::NumaNode) Generate code for initializing the [`LocalVariables`](@ref) strategy on a [`NumaNode`](@ref). """ -function gen_cache_init_code(::NumaNode, ::LocalVariables) - # don't need to initialize anything - return Expr() +function gen_cache_init_code(device::NumaNode) + if typeof(device.cacheStrategy) <: LocalVariables + # don't need to initialize anything + return Expr(:block) + elseif typeof(device.cacheStrategy) <: Dictionary + return Meta.parse("cache_$(to_var_name(device.id)) = Dict{Symbol, Any}()") + # TODO: sizehint? + end + + return error("Unimplemented cache strategy \"$(device.cacheStrategy)\" for device \"$(device)\"") end """ - gen_access_expr(device::NumaNode, strategy::LocalVariables, symbol::Symbol) + gen_access_expr(device::NumaNode, symbol::Symbol) Generate code to access the variable designated by `symbol` using the [`LocalVariables`](@ref) [`CacheStrategy`](@ref) on a [`NumaNode`](@ref). """ -function gen_access_expr(::NumaNode, ::LocalVariables, symbol::Symbol) - s = Symbol("data_$symbol") - quoteNode = Meta.parse(":($s)") - return quoteNode +function gen_access_expr(device::NumaNode, symbol::Symbol) + if typeof(device.cacheStrategy) <: LocalVariables + s = Symbol("data_$symbol") + quoteNode = Meta.parse(":($s)") + return quoteNode + elseif typeof(device.cacheStrategy) <: Dictionary + accessStr = ":(cache_$(to_var_name(device.id))[:$symbol])" + quoteNode = Meta.parse(accessStr) + return quoteNode + end + + return error("Unimplemented cache strategy \"$(device.cacheStrategy)\" for device \"$(device)\"") end diff --git a/src/diff/print.jl b/src/diff/print.jl index 5f6c5ff..5214e6f 100644 --- a/src/diff/print.jl +++ b/src/diff/print.jl @@ -6,6 +6,6 @@ Pretty-print a [`Diff`](@ref). Called via print, println and co. function show(io::IO, diff::Diff) print(io, "Nodes: ") print(io, length(diff.addedNodes) + length(diff.removedNodes)) - print(io, " Edges: ") + print(io, ", Edges: ") return print(io, length(diff.addedEdges) + length(diff.removedEdges)) end diff --git a/src/graph/mute.jl b/src/graph/mute.jl index e09d24e..191fc6f 100644 --- a/src/graph/mute.jl +++ b/src/graph/mute.jl @@ -160,14 +160,17 @@ function remove_edge!(graph::DAG, node1::Node, node2::Node; track = true, invali end function replace_children!(task::FusedComputeTask, before, after) - - replace!(task.t1_inputs, before => after) - replace!(task.t2_inputs, before => after) + # TODO: this assert fails sometimes and really shouldn't + @assert length(findall(x -> x == before, task.t1_inputs)) >= 1 || + length(findall(x -> x == before, task.t2_inputs)) >= 1 "Replacing $before with $after in $(task.t1_inputs...) and $(task.t2_inputs...)" # recursively descend down the tree replace_children!(task.first_task, before, after) replace_children!(task.second_task, before, after) + replace!(task.t1_inputs, before => after) + replace!(task.t2_inputs, before => after) + return nothing end @@ -181,6 +184,16 @@ function update_child!(graph::DAG, n::Node, child_before::Symbol, child_after::S return nothing end + if !((child_before in n.task.t1_inputs) || (child_before in n.task.t2_inputs)) + println("------------------ Nothing to replace!! ------------------") + child_ids = Vector{String}() + for child in n.children + push!(child_ids, "$(child.id)") + end + println("From $(child_before) to $(child_after) in $n with children $(child_ids)") + @assert false + end + replace_children!(n.task, child_before, child_after) if !((child_after in n.task.t1_inputs) || (child_after in n.task.t2_inputs)) diff --git a/src/node/print.jl b/src/node/print.jl index c39c1b5..61200a9 100644 --- a/src/node/print.jl +++ b/src/node/print.jl @@ -22,5 +22,6 @@ end Return the uuid as a string usable as a variable name in code generation. """ function to_var_name(id::UUID) - return replace(string(id), "-" => "_") + str = "_" * replace(string(id), "-" => "_") + return str end diff --git a/src/node/validate.jl b/src/node/validate.jl index 8a066cd..d7ad4dd 100644 --- a/src/node/validate.jl +++ b/src/node/validate.jl @@ -22,12 +22,12 @@ function is_valid_node(graph::DAG, node::Node) @assert node in child.parents "Node is not a parent of its child!" end - if !ismissing(node.nodeReduction) + #=if !ismissing(node.nodeReduction) @assert is_valid(graph, node.nodeReduction) end if !ismissing(node.nodeSplit) @assert is_valid(graph, node.nodeSplit) - end + end=# if !(typeof(node.task) <: FusedComputeTask) # the remaining checks are only necessary for fused compute tasks @@ -53,9 +53,9 @@ This also calls [`is_valid_node(graph::DAG, node::Node)`](@ref). function is_valid(graph::DAG, node::ComputeTaskNode) @assert is_valid_node(graph, node) - for nf in node.nodeFusions + #=for nf in node.nodeFusions @assert is_valid(graph, nf) - end + end=# return true end @@ -69,8 +69,8 @@ This also calls [`is_valid_node(graph::DAG, node::Node)`](@ref). function is_valid(graph::DAG, node::DataTaskNode) @assert is_valid_node(graph, node) - if !ismissing(node.nodeFusion) + #=if !ismissing(node.nodeFusion) @assert is_valid(graph, node.nodeFusion) - end + end=# return true end diff --git a/src/operation/apply.jl b/src/operation/apply.jl index eca2679..229f9ef 100644 --- a/src/operation/apply.jl +++ b/src/operation/apply.jl @@ -9,6 +9,7 @@ function apply_all!(graph::DAG) op = popfirst!(graph.operationsToApply) # apply it + println(graph.appliedOperations) appliedOp = apply_operation!(graph, op) # push to the end of the appliedOperations deque @@ -158,8 +159,17 @@ function node_fusion!(graph::DAG, n1::ComputeTaskNode, n2::DataTaskNode, n3::Com get_snapshot_diff(graph) # save children and parents - n1_children = children(n1) - n3_parents = parents(n3) + n1Children = children(n1) + n3Parents = parents(n3) + + n1Task = copy(n1.task) + n3Task = copy(n3.task) + + # assemble the input node vectors of n1 and n3 to save into the FusedComputeTask + n1Inputs = Vector{Symbol}() + for child in n1Children + push!(n1Inputs, Symbol(to_var_name(child.id))) + end # remove the edges and nodes that will be replaced by the fused node remove_edge!(graph, n1, n2) @@ -168,43 +178,38 @@ function node_fusion!(graph::DAG, n1::ComputeTaskNode, n2::DataTaskNode, n3::Com remove_node!(graph, n2) # get n3's children now so it automatically excludes n2 - n3_children = children(n3) + n3Children = children(n3) + + n3Inputs = Vector{Symbol}() + for child in n3Children + push!(n3Inputs, Symbol(to_var_name(child.id))) + end + remove_node!(graph, n3) - # assemble the input node vectors of n1 and n3 to save into the FusedComputeTask - n1_inputs = Vector{Symbol}() - for child in n1_children - push!(n1_inputs, Symbol(to_var_name(child.id))) - end - - n3_inputs = Vector{Symbol}() - for child in n3_children - push!(n3_inputs, Symbol(to_var_name(child.id))) - end - # create new node with the fused compute task - new_node = ComputeTaskNode(FusedComputeTask(n1.task, n3.task, n1_inputs, Symbol(to_var_name(n2.id)), n3_inputs)) - insert_node!(graph, new_node) + newNode = ComputeTaskNode(FusedComputeTask(n1Task, n3Task, n1Inputs, Symbol(to_var_name(n2.id)), n3Inputs)) + insert_node!(graph, newNode) - for child in n1_children + for child in n1Children remove_edge!(graph, child, n1) - insert_edge!(graph, child, new_node) + insert_edge!(graph, child, newNode) end - for child in n3_children + for child in n3Children remove_edge!(graph, child, n3) - if !(child in n1_children) - insert_edge!(graph, child, new_node) + if !(child in n1Children) + insert_edge!(graph, child, newNode) end end - for parent in n3_parents + for parent in n3Parents remove_edge!(graph, n3, parent) - insert_edge!(graph, new_node, parent) + insert_edge!(graph, newNode, parent) # important! update the parent node's child names in case they are fused compute tasks # needed for compute generation so the fused compute task can correctly match inputs to its component tasks - update_child!(graph, parent, Symbol(to_var_name(n3.id)), Symbol(to_var_name(new_node.id))) + update_child!(graph, parent, Symbol(to_var_name(n3.id)), Symbol(to_var_name(newNode.id))) end return get_snapshot_diff(graph) @@ -224,14 +229,14 @@ function node_reduction!(graph::DAG, nodes::Vector{Node}) get_snapshot_diff(graph) n1 = nodes[1] - n1_children = children(n1) + n1Children = children(n1) - n1_parents = Set(n1.parents) + n1Parents = Set(n1.parents) # set of the new parents of n1 - new_parents = Set{Node}() + newParents = Set{Node}() # names of the previous children that n1 now replaces per parent - new_parents_child_names = Dict{Node, Symbol}() + newParentsChildNames = Dict{Node, Symbol}() str = Vector{String}() for n in nodes @@ -242,7 +247,7 @@ function node_reduction!(graph::DAG, nodes::Vector{Node}) # remove all of the nodes' parents and children and the nodes themselves (except for first node) for i in 2:length(nodes) n = nodes[i] - for child in n1_children + for child in n1Children remove_edge!(graph, child, n) end @@ -250,21 +255,21 @@ function node_reduction!(graph::DAG, nodes::Vector{Node}) remove_edge!(graph, n, parent) # collect all parents - push!(new_parents, parent) - new_parents_child_names[parent] = Symbol(to_var_name(n.id)) + push!(newParents, parent) + newParentsChildNames[parent] = Symbol(to_var_name(n.id)) end remove_node!(graph, n) end - setdiff!(new_parents, n1_parents) + setdiff!(newParents, n1Parents) - for parent in new_parents + for parent in newParents # now add parents of all input nodes to n1 without duplicates insert_edge!(graph, n1, parent) - prev_child = new_parents_child_names[parent] - update_child!(graph, parent, prev_child, Symbol(to_var_name(n1.id))) + prevChild = newParentsChildNames[parent] + update_child!(graph, parent, prevChild, Symbol(to_var_name(n1.id))) end return get_snapshot_diff(graph) @@ -283,28 +288,28 @@ function node_split!(graph::DAG, n1::Node) # clear snapshot get_snapshot_diff(graph) - n1_parents = parents(n1) - n1_children = children(n1) + n1Parents = parents(n1) + n1Children = children(n1) - for parent in n1_parents + for parent in n1Parents remove_edge!(graph, n1, parent) end - for child in n1_children + for child in n1Children remove_edge!(graph, child, n1) end remove_node!(graph, n1) - for parent in n1_parents - n_copy = copy(n1) + for parent in n1Parents + nCopy = copy(n1) - insert_node!(graph, n_copy) - insert_edge!(graph, n_copy, parent) + insert_node!(graph, nCopy) + insert_edge!(graph, nCopy, parent) - for child in n1_children - insert_edge!(graph, child, n_copy) + for child in n1Children + insert_edge!(graph, child, nCopy) end - update_child!(graph, parent, Symbol(to_var_name(n1.id)), Symbol(to_var_name(n_copy.id))) + update_child!(graph, parent, Symbol(to_var_name(n1.id)), Symbol(to_var_name(nCopy.id))) end return get_snapshot_diff(graph) diff --git a/src/operation/validate.jl b/src/operation/validate.jl index a065032..0fe3218 100644 --- a/src/operation/validate.jl +++ b/src/operation/validate.jl @@ -32,6 +32,10 @@ function is_valid_node_fusion_input(graph::DAG, n1::ComputeTaskNode, n2::DataTas throw(AssertionError("[Node Fusion] The given n1 has more than one parent")) end + @assert is_valid(graph, n1) + @assert is_valid(graph, n2) + @assert is_valid(graph, n3) + return true end @@ -47,6 +51,7 @@ function is_valid_node_reduction_input(graph::DAG, nodes::Vector{Node}) if n ∉ graph throw(AssertionError("[Node Reduction] The given nodes are not part of the given graph")) end + @assert is_valid(graph, n) end t = typeof(nodes[1].task) @@ -96,6 +101,8 @@ function is_valid_node_split_input(graph::DAG, n1::Node) ) end + @assert is_valid(graph, n1) + return true end diff --git a/src/task/compute.jl b/src/task/compute.jl index e0f98d3..f23df77 100644 --- a/src/task/compute.jl +++ b/src/task/compute.jl @@ -24,14 +24,14 @@ function get_expression(t::FusedComputeTask, device::AbstractDevice, inExprs::Ve inExprs1 = Vector() for sym in t.t1_inputs - push!(inExprs1, gen_access_expr(device, cacheStrategy, sym)) + push!(inExprs1, gen_access_expr(device, sym)) end - outExpr1 = gen_access_expr(device, cacheStrategy, t.t1_output) + outExpr1 = gen_access_expr(device, t.t1_output) inExprs2 = Vector() for sym in t.t2_inputs - push!(inExprs2, gen_access_expr(device, cacheStrategy, sym)) + push!(inExprs2, gen_access_expr(device, sym)) end expr1 = get_expression(t.first_task, device, inExprs1, outExpr1) @@ -56,9 +56,9 @@ function get_expression(node::ComputeTaskNode, device::AbstractDevice) inExprs = Vector() for id in getfield.(node.children, :id) - push!(inExprs, gen_access_expr(device, cacheStrategy, Symbol(to_var_name(id)))) + push!(inExprs, gen_access_expr(device, Symbol(to_var_name(id)))) end - outExpr = gen_access_expr(device, cacheStrategy, Symbol(to_var_name(node.id))) + outExpr = gen_access_expr(device, Symbol(to_var_name(node.id))) return get_expression(node.task, device, inExprs, outExpr) end @@ -77,11 +77,11 @@ function get_expression(node::DataTaskNode, device::AbstractDevice) cacheStrategy = cache_strategy(device) inExpr = nothing if (length(node.children) == 1) - inExpr = eval(gen_access_expr(device, cacheStrategy, Symbol(to_var_name(node.children[1].id)))) + inExpr = eval(gen_access_expr(device, Symbol(to_var_name(node.children[1].id)))) else - inExpr = eval(gen_access_expr(device, cacheStrategy, Symbol("$(to_var_name(node.id))_in"))) + inExpr = eval(gen_access_expr(device, Symbol("$(to_var_name(node.id))_in"))) end - outExpr = eval(gen_access_expr(device, cacheStrategy, Symbol(to_var_name(node.id)))) + outExpr = eval(gen_access_expr(device, Symbol(to_var_name(node.id)))) dataTransportExp = Meta.parse("$outExpr = $inExpr") diff --git a/test/unit_tests_execution.jl b/test/unit_tests_execution.jl index eab92a5..57f23c6 100644 --- a/test/unit_tests_execution.jl +++ b/test/unit_tests_execution.jl @@ -36,7 +36,7 @@ include("../examples/profiling_utilities.jl") end @testset "AB->AB after random walk" begin - for i in 1:100 + for i in 1:1000 graph = parse_dag(joinpath(@__DIR__, "..", "input", "AB->AB.txt"), ABCModel()) random_walk!(graph, 50) @test is_valid(graph)