cusir


Namecusir JSON
Version 1.0.1 PyPI version JSON
download
home_page
SummaryA SIR diffusive model based in CuPy
upload_time2023-01-20 15:15:10
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords sir epidemiology cupy gpu cuda diffusion reaction-diffusion parallel computing
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- LTeX: language=en-US -->
# CuSIR

## Introduction 
CuSIR is a Python code built on top of CuPy, a NumPy-like library for GPU-accelerated computing. It provides a solver for the two-dimensional diffusive SIR model, described by the following system of reaction-diffusion equations:

$$
\begin{align}   
\partial_t S &= -\beta_{\mathbf{r}} S I - \gamma I + D_I \nabla^2 I \\\\\\\\
\partial_t I &= \beta_{\mathbf{r}} S I + D_S \nabla^2 S - \mathbf{v} \cdot \nabla I,
\end{align}
$$

where $S$ is the density of susceptible individuals, $I$ is the density of infected individuals, $\beta_{\mathbf{r}}$ is the transmission rate that depends on the location $\mathbf{r}$, $\gamma$ is the recovery/removal rate, $D_I$ and $D_S$ are diffusion coefficients, and $\mathbf{v}$ is the convection field. 

## Requirements

To use the CuSIR package, you will need the following software and hardware:

- A CUDA-compatible GPU: A graphics processing unit (GPU) that supports CUDA. Check the list of CUDA-compatible GPUs on the NVIDIA website (https://developer.nvidia.com/cuda-gpus) to see if your GPU is supported.

- CUDA Toolkit: A parallel computing platform and programming model developed by NVIDIA for general-purpose computing on GPUs. You can download CUDA from the NVIDIA website (https://developer.nvidia.com/cuda-downloads). 

*Note: Currently (January, 2023), the last version of CUDA (12) is not supported by CuPy. You will need to install any previous version of CUDA (recommended 11.2) to use CuSIR.* 

- CuPy: A NumPy-like library for GPU-accelerated computing. You can install CuPy by following the instructions in the CuPy documentation (https://docs-cupy.chainer.org/en/stable/install.html).

## Installation

To install the CuSIR package, you can use pip by running the following command in your command prompt or terminal:

```bash
pip install cusir
```

This command will install the latest version of the CuSIR package. It is mandatory to meet the requirements listed above for CuSIR to work properly.

## Usage

Almost everything is implemented in the `system` class, which is located in the `system` module. The following code shows how to use the `system` class to solve the diffusive SIR model:

```python
import cusir.system as cs

# Define the spatial domain
Lx = 2**10
Ly = 2**10

# Create the system object
s = cs.system(Lx, Ly)

# Define the system parameters
s.beta = 1 # Transmission rate
s.gamma = 0.1 # Recovery/removal rate  
s.D_I = 1 # Diffusion coefficient for infected individuals
s.D_S = 1 # Diffusion coefficient for susceptible individuals

# Define the initial conditions
s.set_plane_initial_conditions()

# Solve the system
for _ in range(10000):
    s.update() # Update the system
    s.rigid_x() # Apply rigid boundary conditions in the x-direction

#You can also use the following to do the same:
#s.solve(10000)

# Get the solution
S = s.S.get() # get() pulls the data from the GPU to the CPU as a NumPy array
I = s.I.get()
```

## License

CuSIR is licensed under the MIT license. See the `LICENSE` file for more details.





            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cusir",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "sir,epidemiology,CuPy,GPU,CUDA,diffusion,reaction-diffusion,parallel computing",
    "author": "",
    "author_email": "renzozs <renzozagarrasaez@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/24/33/db72509660f415ce45d497ad840696b9d2057662ce85bac953d06f83e2e0/cusir-1.0.1.tar.gz",
    "platform": null,
    "description": "<!-- LTeX: language=en-US -->\n# CuSIR\n\n## Introduction \nCuSIR is a Python code built on top of CuPy, a NumPy-like library for GPU-accelerated computing. It provides a solver for the two-dimensional diffusive SIR model, described by the following system of reaction-diffusion equations:\n\n$$\n\\begin{align}   \n\\partial_t S &= -\\beta_{\\mathbf{r}} S I - \\gamma I + D_I \\nabla^2 I \\\\\\\\\\\\\\\\\n\\partial_t I &= \\beta_{\\mathbf{r}} S I + D_S \\nabla^2 S - \\mathbf{v} \\cdot \\nabla I,\n\\end{align}\n$$\n\nwhere $S$ is the density of susceptible individuals, $I$ is the density of infected individuals, $\\beta_{\\mathbf{r}}$ is the transmission rate that depends on the location $\\mathbf{r}$, $\\gamma$ is the recovery/removal rate, $D_I$ and $D_S$ are diffusion coefficients, and $\\mathbf{v}$ is the convection field. \n\n## Requirements\n\nTo use the CuSIR package, you will need the following software and hardware:\n\n- A CUDA-compatible GPU: A graphics processing unit (GPU) that supports CUDA. Check the list of CUDA-compatible GPUs on the NVIDIA website (https://developer.nvidia.com/cuda-gpus) to see if your GPU is supported.\n\n- CUDA Toolkit: A parallel computing platform and programming model developed by NVIDIA for general-purpose computing on GPUs. You can download CUDA from the NVIDIA website (https://developer.nvidia.com/cuda-downloads). \n\n*Note: Currently (January, 2023), the last version of CUDA (12) is not supported by CuPy. You will need to install any previous version of CUDA (recommended 11.2) to use CuSIR.* \n\n- CuPy: A NumPy-like library for GPU-accelerated computing. You can install CuPy by following the instructions in the CuPy documentation (https://docs-cupy.chainer.org/en/stable/install.html).\n\n## Installation\n\nTo install the CuSIR package, you can use pip by running the following command in your command prompt or terminal:\n\n```bash\npip install cusir\n```\n\nThis command will install the latest version of the CuSIR package. It is mandatory to meet the requirements listed above for CuSIR to work properly.\n\n## Usage\n\nAlmost everything is implemented in the `system` class, which is located in the `system` module. The following code shows how to use the `system` class to solve the diffusive SIR model:\n\n```python\nimport cusir.system as cs\n\n# Define the spatial domain\nLx = 2**10\nLy = 2**10\n\n# Create the system object\ns = cs.system(Lx, Ly)\n\n# Define the system parameters\ns.beta = 1 # Transmission rate\ns.gamma = 0.1 # Recovery/removal rate  \ns.D_I = 1 # Diffusion coefficient for infected individuals\ns.D_S = 1 # Diffusion coefficient for susceptible individuals\n\n# Define the initial conditions\ns.set_plane_initial_conditions()\n\n# Solve the system\nfor _ in range(10000):\n    s.update() # Update the system\n    s.rigid_x() # Apply rigid boundary conditions in the x-direction\n\n#You can also use the following to do the same:\n#s.solve(10000)\n\n# Get the solution\nS = s.S.get() # get() pulls the data from the GPU to the CPU as a NumPy array\nI = s.I.get()\n```\n\n## License\n\nCuSIR is licensed under the MIT license. See the `LICENSE` file for more details.\n\n\n\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "A SIR diffusive model based in CuPy",
    "version": "1.0.1",
    "split_keywords": [
        "sir",
        "epidemiology",
        "cupy",
        "gpu",
        "cuda",
        "diffusion",
        "reaction-diffusion",
        "parallel computing"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "922e87a6543c961c5b6341bc0ba41e7fc2afadf082fa5830e6afc84582e6b15e",
                "md5": "08e5f0f4b2b34e62f753fc688e80483d",
                "sha256": "9f36c4d43a9edd17c4fa47945f52b3ccc241775109dae6267a170bf3981c3300"
            },
            "downloads": -1,
            "filename": "cusir-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "08e5f0f4b2b34e62f753fc688e80483d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 7502,
            "upload_time": "2023-01-20T15:15:08",
            "upload_time_iso_8601": "2023-01-20T15:15:08.243809Z",
            "url": "https://files.pythonhosted.org/packages/92/2e/87a6543c961c5b6341bc0ba41e7fc2afadf082fa5830e6afc84582e6b15e/cusir-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "2433db72509660f415ce45d497ad840696b9d2057662ce85bac953d06f83e2e0",
                "md5": "763ec618cab520e41662d09d8fae2a4d",
                "sha256": "fb82e99f85a0b285834e3496b83a76bbc2b8990298eafe90c3741b8a03f29168"
            },
            "downloads": -1,
            "filename": "cusir-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "763ec618cab520e41662d09d8fae2a4d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 9569,
            "upload_time": "2023-01-20T15:15:10",
            "upload_time_iso_8601": "2023-01-20T15:15:10.599592Z",
            "url": "https://files.pythonhosted.org/packages/24/33/db72509660f415ce45d497ad840696b9d2057662ce85bac953d06f83e2e0/cusir-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-20 15:15:10",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "cusir"
}
        
Elapsed time: 0.03005s