Skip to content

Instantly share code, notes, and snippets.

@gravitino
Last active April 20, 2021 19:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gravitino/bc82139f44df42288bee4fb460775916 to your computer and use it in GitHub Desktop.
Save gravitino/bc82139f44df42288bee4fb460775916 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"elapsed time: 8 ms (align sdist fft)\n",
"elapsed time: 43 ms (align sdist naive)\n",
"elapsed time: 8 ms (align sdist fft)\n",
"elapsed time: 43 ms (align sdist naive)\n",
"elapsed time: 8 ms (align sdist fft)\n",
"elapsed time: 43 ms (align sdist naive)\n",
"elapsed time: 8 ms (align sdist fft)\n",
"elapsed time: 44 ms (align sdist naive)\n",
"elapsed time: 8 ms (align sdist fft)\n",
"elapsed time: 43 ms (align sdist naive)\n"
]
}
],
"source": [
"query_gpu, subject_gpu = cp.asarray(query), cp.asarray(subject)\n",
"\n",
"for _ in range(num_repeats):\n",
" with ra.util.Timer(\"align sdist fft\"):\n",
" ying = ra.ED.sdist(query_gpu, subject_gpu, mode=\"fft\")\n",
" with ra.util.Timer(\"align sdist naive\"):\n",
" yang = ra.ED.sdist(query_gpu, subject_gpu, mode=\"naive\")\n",
" \n",
"assert(cp.allclose(ying, yang))"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment