• bitcoinBitcoin(BTC)$78,001.00-1.27%
  • ethereumEthereum(ETH)$2,468.05-1.01%
  • tetherTether(USDT)$1.00-0.01%
  • binancecoinBNB(BNB)$718.09-4.19%
  • rippleXRP(XRP)$1.38-2.98%
  • usd-coinUSDC(USDC)$1.000.00%
  • solanaSolana(SOL)$101.45-2.22%
  • tronTRON(TRX)$0.3403510.38%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.030.00%
  • zcashZcash(ZEC)$1,233.03-2.43%
  • HyperliquidHyperliquid(HYPE)$83.20-3.05%
  • dogecoinDogecoin(DOGE)$0.085412-5.62%
  • RainRain(RAIN)$0.0161600.88%
  • USDSUSDS(USDS)$1.000.01%
  • moneroMonero(XMR)$508.852.80%
  • whitebitWhiteBIT Coin(WBT)$80.63-1.33%
  • chainlinkChainlink(LINK)$11.87-1.60%
  • leo-tokenLEO Token(LEO)$9.230.52%
  • cardanoCardano(ADA)$0.213445-2.56%
  • stellarStellar(XLM)$0.179918-4.31%
  • bitcoin-cashBitcoin Cash(BCH)$245.82-4.57%
  • daiDai(DAI)$1.000.00%
  • Ethena USDeEthena USDe(USDE)$1.00-0.02%
  • USD1USD1(USD1)$1.000.00%
  • litecoinLitecoin(LTC)$52.27-3.26%
  • CantonCanton(CC)$0.101594-4.04%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.37-1.95%
  • uniswapUniswap(UNI)$6.04-9.64%
  • avalanche-2Avalanche(AVAX)$7.76-2.35%
  • hedera-hashgraphHedera(HBAR)$0.076391-2.66%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • nearNEAR Protocol(NEAR)$2.43-5.90%
  • suiSui(SUI)$0.76-5.35%
  • shiba-inuShiba Inu(SHIB)$0.000005-4.94%
  • paypal-usdPayPal USD(PYUSD)$1.000.00%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • crypto-com-chainCronos(CRO)$0.056788-5.63%
  • MemeCoreMemeCore(M)$1.201.20%
  • tether-goldTether Gold(XAUT)$4,387.37-0.37%
  • Circle USYCCircle USYC(USYC)$1.140.01%
  • BittensorBittensor(TAO)$253.37-4.15%
  • Ripple USDRipple USD(RLUSD)$1.00-0.01%
  • okbOKB(OKB)$112.14-1.88%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.15-0.12%
  • mantleMantle(MNT)$0.59-7.06%
  • AsterAster(ASTER)$0.72-4.51%
  • aaveAave(AAVE)$123.32-4.52%
  • pax-goldPAX Gold(PAXG)$4,389.53-0.41%
  • polkadotPolkadot(DOT)$1.10-6.30%
  • World Liberty FinancialWorld Liberty Financial(WLFI)$0.0564221.28%
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

Fujitsu Signs New Palantir AIP Agreement, Becomes Global FDE Partner – Unite.AI

AppleCare One Now Has A $50 Tier Per Month For Families

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

Fujitsu Signs New Palantir AIP Agreement, Becomes Global FDE Partner – Unite.AI
AI & Technology

Fujitsu Signs New Palantir AIP Agreement, Becomes Global FDE Partner – Unite.AI

September 10, 2026
AppleCare One Now Has A  Tier Per Month For Families
AI & Technology

AppleCare One Now Has A $50 Tier Per Month For Families

September 10, 2026
DeepSeek AI Released DeepSeek-V4.1-Flash with 1M Context, FP4 KV Cache, and Cross-Layer Attention Reuse
AI & Technology

DeepSeek AI Released DeepSeek-V4.1-Flash with 1M Context, FP4 KV Cache, and Cross-Layer Attention Reuse

September 10, 2026
2028 Volvo XC40 First Look: Hello new tech, goodbye EV
AI & Technology

2028 Volvo XC40 First Look: Hello new tech, goodbye EV

September 10, 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
Dell: AI Server Growth Backs Value (Rating Upgrade)

Dell: AI Server Growth Backs Value (Rating Upgrade)

September 5, 2026
Mamdani says New Yorkers who wanted Netanyahu arrested can still protest his visit

Mamdani says New Yorkers who wanted Netanyahu arrested can still protest his visit

September 7, 2026
Is the Trade War Back? Also, Examining the Tate Brothers Purported Ties to the Trump Admin | July 21

Is the Trade War Back? Also, Examining the Tate Brothers Purported Ties to the Trump Admin | July 21

September 7, 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!