我目前正在开发一个包,并对 setuptools 感到困惑。该包包含许多依赖项,有了这些依赖项,可以通过 cli 执行多个脚本。
例如
> main_pkg
> main_pkg_which_needs_dep1
> main_pkg_which_needs_dep2
> ...
Run Code Online (Sandbox Code Playgroud)
系统上没有必要让所有脚本都可用。只有相关的。所以我想我可以简单地修改我的setup.py如下:
...
entry_points=dict(console_scripts=[
'main_pkg = main_pkg.main_pkg:main ',
'main_pkg_which_needs_dep1 = main_pkg.main_pkg:main_dep1 [dep1]',
...
]),
...
extras_require={
"dep1": ["psycopg"],
"dep2": ["apsw"],
"dep3": ["numpy"],
...
},
Run Code Online (Sandbox Code Playgroud)
并假设如果有人执行pip install main_pkg,则只能main_pkg在 CLI 中使用。(因此,如果执行,那么CLI 中pip install main_pkg[dep1]就会有main_pkg和available )main_pkg_which_needs_dep1
然而,执行pip install main_pkg还可以console_scripts通过 CLI 使所有其他内容可用,如果执行失败,例如main_pkg_which_needs_dep1由于缺少依赖项。
setuptools 是否期望这种行为?
从文档中我正在阅读以下内容:
由安装程序决定如何处理未指示 PDF 的情况(例如,省略控制台脚本、在尝试加载入口点时提供警告、假设存在额外内容并让执行稍后失败)。
另外,如果查看此处,文档会提到以下内容:
在这种情况下,hello-world …
我无法找到在 CUDA C 中使用共享内存转置非平方矩阵的方法。(我是 CUDA C 和 C 的新手)
在这篇博客文章中,展示了如何转置矩阵的有效方法(通过共享内存合并转置)。但它只适用于方阵。
github上也提供了代码(与博客上相同)。
StackOverflow 上也有类似的问题。有TILE_DIM = 16设定。但通过该实现,每个线程只需将矩阵的一个元素复制到结果矩阵。
这是我当前的实现:
__global__ void transpose(double* matIn, double* matTran, int n, int m){
__shared__ double tile[TILE_DIM][TILE_DIM];
int i_n = blockIdx.x*TILE_DIM + threadIdx.x;
int i_m = blockIdx.y*TILE_DIM + threadIdx.y; // <- threadIdx.y only between 0 and 7
// Load matrix into tile
// Every Thread loads in this case 4 elements into tile.
int i;
for (i = 0; i < …Run Code Online (Sandbox Code Playgroud)