Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

a small bug in NVMatrix::rightMult() #9

Open
GoogleCodeExporter opened this issue Sep 25, 2015 · 0 comments
Open

a small bug in NVMatrix::rightMult() #9

GoogleCodeExporter opened this issue Sep 25, 2015 · 0 comments

Comments

@GoogleCodeExporter
Copy link

The result would be incorrect if the target is same as the first operand. The 
target==this version would require this to be of column major. I modified it so 
that this requirement is no longer needed:

void NVMatrix::rightMult(const NVMatrix &b, float scaleAB, NVMatrix &target) 
const {
    assert(isContiguous() && b.isContiguous() && target.isContiguous());
//    assert(&target != &b);
    assert(_numCols == b.getNumRows());
    if(&target != this) {
        target.resize(_numRows, b.getNumCols());
        //target.setTrans(true); // default column major
    }
    assert(target.getNumRows() == _numRows);
    assert(target.getNumCols() == b.getNumCols());
    if(_numRows % 64 != 0 || _numCols % 64 != 0 || b.getNumCols() % 64 != 0) {
        WARN("Matrix dimensions not divisible by 64 -- cublasSgemm performance may suffer.");
    }
    cublasSgemm(getTransChar(), b.getTransChar(), _numRows, b.getNumCols(), _numCols,
                scaleAB, _devData, getLeadingDim(), b.getDevData(), b.getLeadingDim(),
                0, target.getDevData(), getNumRows());
    target.setTrans(true); // added isTrans specification
    checkCublasError("cublasSgemm failed");
//    cudaThreadSynchronize();
}

Original issue reported on code.google.com by qiwang...@gmail.com on 12 Jul 2013 at 3:47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant