Skip to main content

XGrid

Installation

pip install xgrid

Test

Invoke python3 test.py in the root folder to perform the test cases.

Usage

See document for more information. Let's start with a simple kernel, the element-wise multiplication of two grid:

import xgrid
import numpy as np
import random

xgrid.init()

fvec = xgrid.grid[float, 1]

@xgrid.kernel()
def elementwise_mul(result: fvec, a: fvec, b: fvec) -> None:
    result[0] = a[0] * b[0]

and let's define some data:

a = xgrid.Grid((10000, ), float)
b = xgrid.Grid((10000, ), float)

for i in range(10000):
    a[i] = random.random()
    b[i] = random.random()

and the result:

result = xgrid.Grid((10000, ), float)

and invoke the kernel:

elementwise_mul(result, a, b)

We could check the result using numpy dot:

assert np.sum(result.now) == np.dot(a.now, b.now)

Examples

Solve the 2D Cavity flow with xgrid, see in examples folder.

cavity

Metadata

Release files for xgrid 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for xgrid 0.0.5
File Size Uploaded
xgrid-0.0.5.tar.gz 801.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xgrid 0.0.5
File Interpreter ABI Platform
xgrid-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 828.1 kB

Release files / xgrid-0.0.5.tar.gz

Download URL xgrid-0.0.5.tar.gz
Size 801.6 kB
Tags Source
SHA-256 checksum
How to use checksums
4bf48c904f5e8110c70a75242cc9fb846c99a0476346809994ba812b73c7194a
BLAKE2b-256 checksum
How to use checksums
8f251a617b4ba51f3e801dd6653c9eb71db7921f0f8087a33672e5f467430adc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / xgrid-0.0.5-py3-none-any.whl

Download URL xgrid-0.0.5-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b1e49c15d9ee356e5ac8c61d6cc4f6367bdb03c933ec207c00c1ba629ac45ee7
BLAKE2b-256 checksum
How to use checksums
e95a46acef925a05f12a9336aea4572a6c9ddb3ac1cb247a2e2839570b319db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page