小编Dan*_*Dan的帖子

Cuda共享内存数组变量

我试图为矩阵乘法声明一个变量,如下所示:

__shared__ float As[BLOCK_SIZE][BLOCK_SIZE];
Run Code Online (Sandbox Code Playgroud)

我试图让它成为用户可以输入矩阵的大小来计算,但这意味着改变BLOCK_SIZE.我改变了它但是我收到了编译器错误:"错误:常量值未知".我调查了它,它与这个帖子类似.所以我尝试过:

__shared__ int buf [];
Run Code Online (Sandbox Code Playgroud)

但后来我得到:"错误:不允许不完整的类型"

谢谢,Dan更新代码(几乎遵循本指南和盯着cuda指南):通过询问用户矩阵的大小来传递块大小.他们进入x和y.块大小仅为x,现在它必须接受与x和y相同的大小.

__global__ void matrixMul( float* C, float* A, float* B, int wA, int wB,size_t block_size)
{
    // Block index
    int bx = blockIdx.x;
    int by = blockIdx.y;

    // Thread index
    int tx = threadIdx.x;
    int ty = threadIdx.y;

    // Index of the first sub-matrix of A processed 
    // by the block
    int aBegin = wA * block_size * by;

    // Index of the last sub-matrix of …
Run Code Online (Sandbox Code Playgroud)

c cuda

16
推荐指数
2
解决办法
3万
查看次数

在ScrollView中使用RelativeLayout不会在滚动中产生

我正试图让我的相对布局滚动.我将滚动视图添加为父级,但是当我将手机或模拟器倾斜到水平时,它不会滚动.

我尝试了几种不同的解决方案,但似乎都没有.一些包括: 滚动视图中无滚动,ScrollView无法工作 - 相对布局,而滚动视图不滚动的RelativeLayout

代码如下:

<?xml version="1.0" encoding="utf-8"?>

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/ScrollView01"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:fillViewport="true"
    android:scrollbars="none">
<RelativeLayout

    android:layout_width="fill_parent"
    android:layout_height="fill_parent" 
    android:orientation="vertical">

        <Button
            android:layout_width="200dp" 
            android:id="@+id/register_button"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            android:text="Register" />

        <EditText
            android:id="@+id/email2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/register_button"
            android:layout_alignLeft="@+id/register_button"
            android:layout_alignRight="@+id/register_button"
            android:hint="Re-Enter Email"
            android:inputType="textEmailAddress" />

        <EditText
            android:id="@+id/email1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/email2"
            android:layout_alignLeft="@+id/email2"
            android:layout_alignRight="@+id/email2"
            android:hint="Email"
            android:inputType="textEmailAddress" />

        <EditText
            android:id="@+id/password2"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/email1"
            android:layout_alignLeft="@+id/email1"
            android:layout_alignRight="@+id/email1"
            android:hint="Repeat Password"
            android:inputType="textPassword" />

        <EditText
            android:id="@+id/password1"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/password2"
            android:layout_alignLeft="@+id/password2"
            android:layout_alignRight="@+id/password2"
            android:hint="Password"
            android:inputType="textPassword" />

        <EditText
            android:id="@+id/lastName"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_above="@+id/password1"
            android:layout_alignLeft="@+id/password1" …
Run Code Online (Sandbox Code Playgroud)

android scrollview relativelayout android-layout

5
推荐指数
1
解决办法
3783
查看次数

将Deployd部署到Heroku仪表板密钥

我有一个Deployd应用程序,我试图部署到Heroku.我已成功部署该应用程序,并能够通过它的url命中它.我现在正试图访问仪表板.为了访问仪表板,它需要我从服务器生成密钥.我知道有两种方法可以做到这一点.

这里描述的第一种方法本地生成密钥并将其推送到heroku.我觉得这种方法在将密钥发布到VCS的意义上是不安全的.

第二种方法是使用Procfile和list dpd keygendpd showkey.但由于某种原因,这种方法对我不起作用.我看到命令在heroku日志中执行但它没有打印出键,我无法通过执行看到它heroku run dpd showkey.

我想弄清楚为什么列出我的procfile中的命令不起作用.请在下面找到我的文件:

web: node app.js
cmd: dpd keygen
cmd: dpd showkey
Run Code Online (Sandbox Code Playgroud)

我的日志文件如下:

2015-08-30T19:18:25.012474+00:00 heroku[api]: Starting process with command `dpd showkey` by [email]
2015-08-30T19:18:28.196008+00:00 heroku[run.5122]: Starting process with command `dpd showkey`
2015-08-30T19:18:28.168161+00:00 heroku[run.5122]: Awaiting client
2015-08-30T19:18:28.501367+00:00 heroku[run.5122]: State changed from starting to up
2015-08-30T19:18:31.023033+00:00 heroku[run.5122]: State changed from up to complete
2015-08-30T19:18:31.012416+00:00 heroku[run.5122]: Process exited with status 0
2015-08-30T19:19:36.935285+00:00 …
Run Code Online (Sandbox Code Playgroud)

heroku node.js deployd procfile

5
推荐指数
1
解决办法
356
查看次数

如何使用 cloudformation 处理数据库 ddl/迁移?

我正在使用 Lambdas、SNS 和 MySql 构建一个项目。该项目是使用 CloudFormation 部署的。我最初使用 DynamoDB,但意识到我的数据实际上是关系数据,并且没有大量数据,因此使用 RDS 对我的情况会更好。我很难在网上找到有关如何在 CloudFormation 中处理数据库迁移的信息。

处理这些迁移的正确方法是什么?我找到了有关使用 lambda 进行迁移的信息。这是最好的方法吗?

ddl database-migration amazon-web-services aws-cloudformation aws-lambda

5
推荐指数
0
解决办法
202
查看次数

使用CUDA进行动态矩阵乘法

我一直试图编写的简单程序的想法是从用户那里获取输入,以查看有多大的矩阵相乘.

我希望将输入x乘以x,我目前不打算将两个不同的大小相乘.

你们怎么建议我去完成这个?

对不起,我的问题不够明确,我想修改这个内核,以便它可以处理任何大小的矩阵(其中x和y是等价的,以保持简单).而不是16的倍数.

我不确定你是否需要我当前的代码,但这里是内核代码:

// CUDA Kernel
__global__ void matrixMul( float* C, float* A, float* B, int wA, int wB,size_t block_size)
{
    int bx = blockIdx.x;
    int by = blockIdx.y;
    int tx = threadIdx.x;
    int ty = threadIdx.y;

    int aBegin = wA * block_size * by;
    int aEnd   = aBegin + wA - 1;
    int aStep  = block_size;

    int bBegin = block_size * bx;

    int bStep  = block_size * wB;
    float Csub=0;

    for (int a = aBegin, b = …
Run Code Online (Sandbox Code Playgroud)

cuda matrix matrix-multiplication

2
推荐指数
1
解决办法
1766
查看次数