Unverified Commit db9573ce authored by Gao, Xiang's avatar Gao, Xiang Committed by GitHub
Browse files

Add dummy cuda extension build (#521)



* Add dummy cuda extension build

* save

* run tests

* save

* fix

* pytorch cu110

* no vision

* save

* nl

* save

* save

* save

* save

* save

* save

* save

* autopep8

* more autopep8

* optional=True

* no todo

* fix

* refactor ci

* mypy

* save

* flake8

* os error

* Run cuaev test

* save

* clang format

* Delete delete-me.cu

* Search for cub in pytorch include paths

* nl

* instructions on test

* Add better handle cuaev install/not install

* test_cuaev.py

* clean

* fix
Co-authored-by: default avatarFarhad Ramezanghorbani <farhadrgh@users.noreply.github.com>
parent 9ba09296
import warnings
import importlib_metadata
is_installed = 'torchani.cuaev' in importlib_metadata.metadata('torchani').get_all('Provides')
if is_installed:
import _real_cuaev
cuComputeAEV = _real_cuaev.cuComputeAEV
else:
warnings.warn("cuaev not installed")
def cuComputeAEV(*args, **kwargs):
raise RuntimeError("cuaev is not installed")
#include <cub/cub.cuh>
#include <string>
#include <torch/extension.h>
__global__ void kernel() { printf("Hello World!"); }
std::string say_hello() {
kernel<<<1, 1>>>();
return "Hello World!!!";
}
PYBIND11_MODULE(TORCH_EXTENSION_NAME, m) {
m.def("cuComputeAEV", &say_hello, "Hello World");
}
// This file only exists temporarily for validating the clang-format CI
// This file should be deleted when https://github.com/aiqm/torchani/pull/516
// or https://github.com/aiqm/torchani/pull/521 is merged.
#include <stdio.h>
#include <stdlib.h>
__global__ void print_from_gpu(void) {
printf("Hello World! from thread [%d,%d] \
From device\n",
threadIdx.x, blockIdx.x);
}
int main(void) {
printf("Hello World from host!\n");
print_from_gpu<<<1, 1>>>();
cudaDeviceSynchronize();
return 0;
}
...@@ -9,7 +9,7 @@ import struct ...@@ -9,7 +9,7 @@ import struct
import itertools import itertools
import math import math
import timeit import timeit
import collections import collections.abc
import sys import sys
from ..nn import ANIModel, Ensemble, Gaussian, Sequential from ..nn import ANIModel, Ensemble, Gaussian, Sequential
from ..utils import EnergyShifter, ChemicalSymbolsToInts from ..utils import EnergyShifter, ChemicalSymbolsToInts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment