• bitcoinBitcoin(BTC)$81,445.002.38%
  • ethereumEthereum(ETH)$2,288.721.13%
  • tetherTether(USDT)$1.000.01%
  • rippleXRP(XRP)$1.494.28%
  • binancecoinBNB(BNB)$682.811.18%
  • usd-coinUSDC(USDC)$1.000.00%
  • solanaSolana(SOL)$92.241.21%
  • tronTRON(TRX)$0.3533261.12%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.03-1.03%
  • dogecoinDogecoin(DOGE)$0.1170662.19%
  • whitebitWhiteBIT Coin(WBT)$59.832.17%
  • USDSUSDS(USDS)$1.00-0.01%
  • HyperliquidHyperliquid(HYPE)$45.6116.99%
  • cardanoCardano(ADA)$0.2722462.46%
  • leo-tokenLEO Token(LEO)$10.201.45%
  • zcashZcash(ZEC)$558.786.00%
  • bitcoin-cashBitcoin Cash(BCH)$436.750.38%
  • chainlinkChainlink(LINK)$10.512.72%
  • moneroMonero(XMR)$396.42-0.87%
  • CantonCanton(CC)$0.1673726.99%
  • the-open-networkToncoin(TON)$2.112.24%
  • stellarStellar(XLM)$0.1631652.23%
  • suiSui(SUI)$1.19-1.19%
  • litecoinLitecoin(LTC)$58.251.89%
  • USD1USD1(USD1)$1.000.00%
  • daiDai(DAI)$1.000.01%
  • MemeCoreMemeCore(M)$3.341.67%
  • avalanche-2Avalanche(AVAX)$9.931.51%
  • Ethena USDeEthena USDe(USDE)$1.000.03%
  • hedera-hashgraphHedera(HBAR)$0.0955832.00%
  • shiba-inuShiba Inu(SHIB)$0.0000060.93%
  • RainRain(RAIN)$0.0075700.50%
  • paypal-usdPayPal USD(PYUSD)$1.000.00%
  • Global DollarGlobal Dollar(USDG)$1.00-0.01%
  • crypto-com-chainCronos(CRO)$0.0762051.88%
  • Circle USYCCircle USYC(USYC)$1.120.00%
  • BittensorBittensor(TAO)$307.683.62%
  • tether-goldTether Gold(XAUT)$4,620.13-1.34%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • uniswapUniswap(UNI)$3.742.82%
  • polkadotPolkadot(DOT)$1.372.70%
  • mantleMantle(MNT)$0.693.00%
  • World Liberty FinancialWorld Liberty Financial(WLFI)$0.0698372.99%
  • pax-goldPAX Gold(PAXG)$4,617.20-1.39%
  • nearNEAR Protocol(NEAR)$1.57-1.16%
  • OndoOndo(ONDO)$0.3936092.61%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.13-0.04%
  • Pi NetworkPi Network(PI)$0.1716360.60%
  • okbOKB(OKB)$85.721.03%
  • HTX DAOHTX DAO(HTX)$0.0000021.03%
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
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
The ChatGPT Desktop App For Mac Just Got Hit With A Security Breach
AI & Technology

The ChatGPT Desktop App For Mac Just Got Hit With A Security Breach

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
Beloved Bay Area pizzeria owners stunning reason for closing up shop

Beloved Bay Area pizzeria owners stunning reason for closing up shop

May 9, 2026
AI tool poisoning exposes a major flaw in enterprise agent security

AI tool poisoning exposes a major flaw in enterprise agent security

May 10, 2026
Why You Must Adjust to The Market

Why You Must Adjust to The Market

May 11, 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!