• bitcoinBitcoin(BTC)$80,950.001.69%
  • ethereumEthereum(ETH)$2,266.830.20%
  • tetherTether(USDT)$1.000.01%
  • rippleXRP(XRP)$1.483.48%
  • binancecoinBNB(BNB)$679.050.70%
  • usd-coinUSDC(USDC)$1.00-0.01%
  • solanaSolana(SOL)$91.800.81%
  • tronTRON(TRX)$0.3527640.87%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.03-1.03%
  • dogecoinDogecoin(DOGE)$0.1156481.20%
  • whitebitWhiteBIT Coin(WBT)$59.331.34%
  • USDSUSDS(USDS)$1.000.00%
  • HyperliquidHyperliquid(HYPE)$45.7717.71%
  • cardanoCardano(ADA)$0.2698211.60%
  • leo-tokenLEO Token(LEO)$10.201.40%
  • zcashZcash(ZEC)$547.143.36%
  • bitcoin-cashBitcoin Cash(BCH)$435.430.06%
  • chainlinkChainlink(LINK)$10.391.51%
  • moneroMonero(XMR)$392.73-1.72%
  • CantonCanton(CC)$0.1684467.81%
  • the-open-networkToncoin(TON)$2.100.49%
  • stellarStellar(XLM)$0.1615201.09%
  • suiSui(SUI)$1.18-3.01%
  • litecoinLitecoin(LTC)$58.031.52%
  • USD1USD1(USD1)$1.000.02%
  • daiDai(DAI)$1.000.02%
  • MemeCoreMemeCore(M)$3.361.26%
  • avalanche-2Avalanche(AVAX)$9.850.52%
  • Ethena USDeEthena USDe(USDE)$1.000.00%
  • hedera-hashgraphHedera(HBAR)$0.0949051.28%
  • shiba-inuShiba Inu(SHIB)$0.0000060.11%
  • RainRain(RAIN)$0.0075400.30%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.01%
  • Global DollarGlobal Dollar(USDG)$1.00-0.03%
  • crypto-com-chainCronos(CRO)$0.0758111.41%
  • Circle USYCCircle USYC(USYC)$1.120.00%
  • BittensorBittensor(TAO)$305.143.04%
  • tether-goldTether Gold(XAUT)$4,613.02-1.45%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • uniswapUniswap(UNI)$3.701.75%
  • polkadotPolkadot(DOT)$1.361.61%
  • mantleMantle(MNT)$0.692.52%
  • World Liberty FinancialWorld Liberty Financial(WLFI)$0.0696011.68%
  • pax-goldPAX Gold(PAXG)$4,610.31-1.48%
  • nearNEAR Protocol(NEAR)$1.56-2.92%
  • OndoOndo(ONDO)$0.3899891.84%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.130.74%
  • Pi NetworkPi Network(PI)$0.170984-0.01%
  • HTX DAOHTX DAO(HTX)$0.0000020.99%
  • okbOKB(OKB)$84.910.12%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

A Coding Implementation to Master GPU Computing with CuPy, Custom CUDA Kernels, Streams, Sparse Matrices, and Profiling

May 14, 2026
in AI & Technology
Reading Time: 1 min read
A A
A Coding Implementation to Master GPU Computing with CuPy, Custom CUDA Kernels, Streams, Sparse Matrices, and Profiling
ShareShareShareShareShare

YOU MAY ALSO LIKE

Developers can now debug and evaluate AI agents locally with Raindrop’s open source tool Workshop

Xbox Elite Controller 3 Leaked By Brazilian Regulator

header("6. RAW CUDA KERNEL — MANDELBROT")
mandel = cp.RawKernel(r'''
extern "C" __global__
void mandel(float xmin, float xmax, float ymin, float ymax,
           int W, int H, int max_iter, int* out) {
   int ix = blockDim.x * blockIdx.x + threadIdx.x;
   int iy = blockDim.y * blockIdx.y + threadIdx.y;
   if (ix >= W || iy >= H) return;
   float cx = xmin + (xmax - xmin) * ix / (W - 1);
   float cy = ymin + (ymax - ymin) * iy / (H - 1);
   float zx = 0.f, zy = 0.f;
   int it = 0;
   while (zx*zx + zy*zy < 4.f && it < max_iter) {
       float t = zx*zx - zy*zy + cx;
       zy = 2.f*zx*zy + cy;
       zx = t; ++it;
   }
   out[iy*W + ix] = it;
}
''', 'mandel')
W, H, ITER = 1024, 1024, 400
img = cp.zeros((H, W), dtype=cp.int32)
threads = (16, 16)
blocks = ((W + 15)//16, (H + 15)//16)
mandel(blocks, threads,
      (cp.float32(-2.0), cp.float32(1.0),
       cp.float32(-1.5), cp.float32(1.5),
       W, H, ITER, img))
cp.cuda.Stream.null.synchronize()
print(f"Mandelbrot done. max iter reached={int(img.max())}")
plt.figure(figsize=(6,6))
plt.imshow(cp.asnumpy(cp.log1p(img)), cmap='twilight_shifted', extent=[-2,1,-1.5,1.5])
plt.title("Mandelbrot set — computed with a CuPy RawKernel")
plt.axis('off'); plt.show()
header("7. CUDA STREAMS")
s1, s2 = cp.cuda.Stream(non_blocking=True), cp.cuda.Stream(non_blocking=True)
with s1:
   a1 = cp.random.rand(2000, 2000, dtype=cp.float32)
   b1 = cp.random.rand(2000, 2000, dtype=cp.float32)
   c1 = a1 @ b1
with s2:
   a2 = cp.random.rand(2000, 2000, dtype=cp.float32)
   b2 = cp.random.rand(2000, 2000, dtype=cp.float32)
   c2 = a2 @ b2
s1.synchronize(); s2.synchronize()
print(f"Stream-1 mean={float(c1.mean()):.4f}")
print(f"Stream-2 mean={float(c2.mean()):.4f}")

Credit: Source link

ShareTweetSendSharePin

Related Posts

Developers can now debug and evaluate AI agents locally with Raindrop’s open source tool Workshop
AI & Technology

Developers can now debug and evaluate AI agents locally with Raindrop’s open source tool Workshop

May 14, 2026
Xbox Elite Controller 3 Leaked By Brazilian Regulator
AI & Technology

Xbox Elite Controller 3 Leaked By Brazilian Regulator

May 14, 2026
The Original Doom Soundtrack Is Officially In The Library Of Congress
AI & Technology

The Original Doom Soundtrack Is Officially In The Library Of Congress

May 14, 2026
Claude Code’s ‘/goals’ separates the agent that works from the one that decides it’s done
AI & Technology

Claude Code’s ‘/goals’ separates the agent that works from the one that decides it’s done

May 14, 2026
Next Post
Preliminary investigation suggests WHCD shooter was targeting Trump admin, Acting AG Blanche says

Preliminary investigation suggests WHCD shooter was targeting Trump admin, Acting AG Blanche says

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
GameStop’s  Billion Bid for eBay | Bloomberg Tech 5/4/2026

GameStop’s $56 Billion Bid for eBay | Bloomberg Tech 5/4/2026

May 8, 2026
Why the ‘SpaceMob’ Is So Bullish on AST

Why the ‘SpaceMob’ Is So Bullish on AST

May 12, 2026
SAF-Holland SE 2026 Q1 – Results – Earnings Call Presentation (OTCMKTS:SFHLF) 2026-05-09

SAF-Holland SE 2026 Q1 – Results – Earnings Call Presentation (OTCMKTS:SFHLF) 2026-05-09

May 9, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!