allocation

CUDA: Mapping Error using CUSPARSE csrmv() routine

醉酒当歌 提交于 2019-12-13 08:27:11
问题 I'm currently trying to use the CUSPARSE library in order to speed up an HPCG implementation. However, it appears I'm making some kind of mistake during device data allocation. This is the code segment that results in CUSPARSE_STATUS_MAPPING_ERROR : int HPC_sparsemv( CRS_Matrix *A_crs_d, FP * x_d, FP * y_d) { FP alpha = 1.0f; FP beta = 0.0f; FP* vals = A_crs_d->vals; int* inds = A_crs_d->col_ind; int* row_ptr = A_crs_d->row_ptr; /*generate Matrix descriptor for SparseMV computation*/

Why do people use variables in some cases?

余生颓废 提交于 2019-12-13 08:07:36
问题 I know this question title looks scary, but it isn't. Sorry! Ok, so, what's the point of creating a one-time-only/unchangeable "variable"? Lets say I have one property called "name" in a Person object. const Person = { name: 'Luis Felipe Zaguini' }; Alright. So, it's incredibly common to see people doing this: let personName = Person.name; console.log(`I've written my name, and it is ${personName}.`); And that's it. In the majority of times that variable is used only once. Or, sometimes, it's

boost::pool_allocator needs eight static libraries?

余生颓废 提交于 2019-12-13 04:13:45
问题 I tried to add to my project rather limited functionality from the Boost library, namely allocating memory for small objects from a pool with the help of the 'pool_allocator' class, and discovered that I need to add to the project dependendencies to 4 debug static library files and to 4 release static library files. I.e. 8 library file dependencies are needed for a single line like this: boost::container::vector<int, boost::pool_allocator<int> > v; Is there a way to using these classes

dynamically created arrays

给你一囗甜甜゛ 提交于 2019-12-13 03:39:39
问题 My task consists of two parts. First I have to create globbal char array of 100 elements, and insert some text to it using cin. Afterwards calculate amount of chars, and create dedicated array with the length of the inputted text. I was thinking about following solution : char[100]inputData; int main() { cin >> inputData >> endl; int length=0; for(int i=0; i<100; i++) { while(inputData[i] == "\0") { ++count; } } char c = new char[count]; Am I thinking good ? Second part of the task is to

strange behaviour of std::vector::resize() with gcc 4.7.0

前提是你 提交于 2019-12-12 17:30:23
问题 I'm still confused about the behaviour of std::vector::resize() . Consider the following code (see also type requirements for std::vector<type>) struct A { A() : X(0) { std::cerr<<" A::A(); this="<<this<<'\n'; } A(A const&) { assert(0); } // is required but doesn't fire in vector::resize int X; }; int main() { std::vector<A> a; a.resize(4); // would not compile without A::A(A const&) or A::A(A&&) } Without A::A(A const&) or A::A(A&&) , the line with a.resize(4); doesn't compile. However, that

sql query to do specific matching of demands

那年仲夏 提交于 2019-12-12 06:29:32
问题 so I have a small problem whilst working with SQL and PHP. I have a sql db which has 4 tables namely, customers, requests, products and sellers. Now, each table contains self explanatory data. Such as customers tables lists the customers, ids, names, adresses, emails etc., products table has product id and the name, the requests table shows the request of products made by customers with the request id[pk], custID[fk from customer table], productid[fk in products table], quantites_requested,

Get variables' types at runtime in C

一世执手 提交于 2019-12-12 05:49:38
问题 Can I get in C the program variables' types those existing in a specific memory segment at runtime. C Does not recognize the error in: int k=5; float s= 3.4; k=s; printf("%d", k); I am trying to change the variables' types at runtime. 回答1: C is a static type language, you can't change a variable's type. This code: int k=5; float s= 3.4; k=s; //type conversion didn't change k 's type, k is still of type int , all it does is to convert the float value ( 3.4f ) to an int (which is 3 ), and

std::list implementation & pointer arithemetic.

纵饮孤独 提交于 2019-12-12 04:56:30
问题 As I understand it, std::vector allocates/de-allocates all the memory it requires each time it's elements grows or shrinks, therefore pointer arithmetic can be used to iterate the vector elements. std::list on the other hand uses a double linked list, with each element pointing to the next and previous element. Assuming(possibly wrongly) that std::list allocates it's memory dynamically, so memory is allocated, if and when required, incrementally. How is std::list still able to offer pointer

Does appending/removing entries to a Java list reallocate memory?

假装没事ソ 提交于 2019-12-12 04:16:26
问题 This is low-level memory question about how Java performs .add and .remove on an ArrayList or other types of lists. I would think that Java would have to do a reallocation of memory to append/remove items to a list, but it could be doing something I'm not thinking of to avoid this. Does anyone know? 回答1: If by "regular list" you mean java.util.List , that is an interface. It does not specify anything about whether or when any memory is allocated in association with adding or removing elements

Dynamic Allocation 2d array in C difference with a simple 2d array Mpi

我与影子孤独终老i 提交于 2019-12-12 01:33:51
问题 I have a MPI program for image processing (pgm file) in MPI C and I use Dynamic allocation for a 2D Array as follows. float **masterbuf; masterbuf = arralloc(sizeof(float), 2, M, N); When I use float masterbuf[M][N]; the image that the program gives looks fine. The problem is that when I use dynamic allocation the image loses some pixels in its left side. So these missing pixels create a black line. It's like the image has been shifted 2 pixels right. I don't do any other operations to the