#+title: MPI + CUDA, SLURM #+subtitle: Financial Transactions Dataset: Analytics #+date: 2025H2 * Task Dataset: [[https://www.kaggle.com/datasets/computingvictor/transactions-fraud-datasets ][💳 Financial Transactions Dataset: Analytics | Kaggle]] #+begin_note These are computer translated notes, just read the report. #+end_note ** The general part The general part of the wording is as follows. It is necessary to develop (and test) a parallel application using the capabilities of *MPI* and *CUDA*, optionally also *OpenMP*. Programming language: *C* and/or *C++*. The application should run as a task in the *SLURM* manager and use all possible computing resources (processors/cores/threads, CUDA accelerators) of those nodes on which the dispatcher sent the task to. It is necessary to prepare a report on the completion of the work. For the design and structure, it is necessary to use *GOST 7.32*. ** Personal part We filter the data, work only with ~credit_limit >= $12,000~, group the data by city (=merchant_city=) and aggregate the amount spending (=amount=) of the client (=client_id=) by month (=date=), output to a file *100* clients with the highest expenses relative to per capita income per month (~per_capita_income/12~). ** The algorithm 1. Filtering load of =cards_data.csv=, where ~credit_limit >= $12,000~ 2. Filtering load of =transactions_data.csv=, where =card_id= was uploaded in step 1 3. Grouping data from =transactions_data.csv= by =merchant_city= 4. For each client in the group, we sum ~amount~ by month in ~group.client.month.sum~ 5. For each client and month in the group ~group.client.date.sum /= ~client.per_capita_income/12~ 6. We sort the group's clients by ~group.client.sum.sum~ (it's enough to sort the top *100*) 7. We output the first *100* customers of the group (in the format =merchant_city=, =client_id=, =group.client.date.sum=) 1. Optional filtering load of =users_data.csv=, where =client_id= ended up in the top 100 (to pretty print results and not just IDs). That is, for each city we want to get the top 100 clients / month (for which and on which cards some nuances are applied). ** On the supercomputer center 4 nodes, each with 2 cores. 2 of the 4 nodes have a GPU. 1. 8 threads simultaneously load their part of =cards_data.csv=. 2. 8 threads exchange loaded hash maps. 3. 8 threads upload their part =transactions_data.csv= (SoA key value). Be careful, the loaded data will be split among all GPUs, transactions from the same month should not end up on multiple GPUs! 4. For each main CPU thread on the GPU node: 3 other threads send loaded transactions to it. It starts on the GPU ~radix_sort_by_key~, ~reduce~ (sum of grouped data). 5. 8 threads simultaneously load their part of =users_data.csv=. (you can do it while we are working on the GPU) 6. User data is sent to the GPU nodes. (you can do it while we are working on GPU) 7. For each GPU node: 2 threads normalize the amounts received (using a hash map with user data). 8. For each GPU node: 2 threads are searching for the top 100 in their part of the data (min_heap AoS key value) 9. For each GPU node: the top 100 threads are combined (min_heap) 10. The top 100 GPU nodes are combined. (min_heap) * Documentation :PROPERTIES: :CUSTOM_ID: documentation :END: The exported report can be found at [[https://git.michalec.dev/files/uni/term-07/supercomp-arch/coursework/report.pdf][this link]]. * Unlicense :PROPERTIES: :CUSTOM_ID: unlicense :END: #+include: UNLICENSE verse