Skip to content

Instantly share code, notes, and snippets.

View abelardojarab's full-sized avatar

Abelardo Jara-Berrocal abelardojarab

View GitHub Profile
@abelardojarab
abelardojarab / general_method_parallel.md
Created February 9, 2025 04:31
General method to solve problems

Parallel Computation: Task Execution, ProcessPoolExecutor, and Ray for Matrix Multiplication

Introduction

Parallel execution is essential for optimizing computational workloads such as matrix multiplication, large-scale data processing, and distributed computing. In this document, we explore:

  1. Creating a Generalized Task Execution Framework
  2. Using ProcessPoolExecutor and Ray for 1D and 2D Task Execution
  3. Parallel Matrix Multiplication (Stripe-Based vs. Block-Based Approaches)

@abelardojarab
abelardojarab / merge_function_events.py
Last active February 8, 2025 02:36
Merge function events in Python
import numpy as np
import multiprocessing
from concurrent.futures import ProcessPoolExecutor
def process_chunk(chunk, chunk_start_idx):
"""Processes a chunk of samples and tracks function lifetimes."""
active_functions = {} # {function_name: start_time}
events = []
for offset, functions in enumerate(chunk):
@abelardojarab
abelardojarab / dfs_bfs.cpp
Last active February 8, 2025 02:38
DFS and BFS Graph Traversal in C++
#include <iostream>
#include <unordered_map>
#include <vector>
#include <queue>
#include <stack>
#include <unordered_set>
class Graph {
private:
std::unordered_map<int, std::vector<int>> adjList;
@abelardojarab
abelardojarab / shared_ptr.cpp
Created January 13, 2025 22:43
shared pointer in C++
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <atomic>
@abelardojarab
abelardojarab / reuse_intermediate_compute_tree.cpp
Last active February 8, 2025 02:39
Reuse intermediate values in N-ary tree compute expression
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <vector>
@abelardojarab
abelardojarab / dma_host.cpp
Created January 26, 2023 17:36
Allocate DMA pages
#include <iostream>
#include <memory>
#include <regex>
#include <cassert>
#include <experimental/filesystem>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/stat.h>
#include <sys/types.h>
@abelardojarab
abelardojarab / flow_test.puml
Last active February 8, 2025 02:40
Test flow for AMD using PlantUML
@startuml
start
:Request created;
while (Review request) is (accepted)
:Jira ticket is created;
:Assign Cloud Performance Engineer (PE) to Jira ticket;
:CPE designs test plan;
:CPE calculate CSP cost;
@abelardojarab
abelardojarab / README.md
Created February 23, 2022 18:12 — forked from smoser/README.md
Boot a specific installed Ubuntu kernel using grub-reboot and grub-set-default

Ubuntu Grub Boot Kernel

Boot a specific installed Ubuntu kernel using grub-reboot and grub-set-default.

This allows you to pick what kernel you want to boot on next reboot, or set the default, without having to know much about how grub works or editing config files.

Usage

  Usage: boot-kernel [options] [kernel]

call grub-reboot or grub-set-default to boot the provided kernel.

From 6cf513dc8c5ab758072d894f10a58fbb4a146bd6 Mon Sep 17 00:00:00 2001
From: Jon Nettleton <[email protected]>
Date: Wed, 6 Oct 2021 09:16:35 -0400
Subject: [PATCH] Aarch64: Make memcpy more compatible with device memory
For normal non-cacheable memory ACE supports 4x128 bit r/w WRAP
transfers or 1x128 bit r/w INCR transfers. By re-ordering the
stp's in memcpy / memmove we can accomodate this better without
impacting the existing code.