topic fastest [parallel] way to initialize a column vector? in IntelĀ® oneAPI Math Kernel Library
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770783#M608
>> is there a way to do this in a more locality/vectorized/parallel high performance way using MKL?<DIV>there are no specific mkl's functions doing this operations because of ...see Timothy's answers above.</DIV>Thu, 19 Apr 2012 14:04:43 GMTGennady_F_Intel2012-04-19T14:04:43Zfastest [parallel] way to initialize a column vector?
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770781#M606
<P>Hello,<BR /><BR />I could not find a BLAS-1 function that would fit this bill and was wondering whether MKL has a function implementation for this. I know stl or boost has i.e. fill but I prefer one impl. that takes into account locality and parallelizes.<BR /><BR />I create a column vector and want to initialize it to a given double value. memset only works for zeroing out the memory but AFAIK it boils down to doing a not so efficient loop. <BR /><BR />Below my C code (pending moving to C++), is there a way to do this in a more locality/vectorized/parallel high performance way using MKL?<BR /><BR />Many thanks in advance,<BR />Best regards,<BR />Giovanni<BR /><BR />/**<BR />* Initialize a vector with a default value<BR />*/<BR />tvector* vector_init_with_default(int capacity, double value) {<BR /> tvector* result = vector_init_static(capacity);<BR /> for (int i = 0; i < capacity; ++i) {<BR /> result->data<I> = value;<BR /> }<BR /><BR /> return result;<BR />}</I></P>Wed, 18 Apr 2012 11:15:16 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770781#M606Azua_Garcia__Giovann2012-04-18T11:15:16Zfastest [parallel] way to initialize a column vector?
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770782#M607
Any auto-vectorizing compiler should generate effective code. As you don't give any hints about array size, you may get an advantage with icc by #pragma vector nontemporal if you expect the array to apan several 4KB pages.<BR />memset should switch automatically into nontemporal stores for suitably large arrays; the inefficiency is in the time taken to determine which branch to take, which isn't significant if the array is that large. icc will substitute memset automatically if it knows value==0.Thu, 19 Apr 2012 11:06:14 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770782#M607TimP2012-04-19T11:06:14Zfastest [parallel] way to initialize a column vector?
https://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770783#M608
>> is there a way to do this in a more locality/vectorized/parallel high performance way using MKL?<DIV>there are no specific mkl's functions doing this operations because of ...see Timothy's answers above.</DIV>Thu, 19 Apr 2012 14:04:43 GMThttps://community.intel.com/t5/Intel-oneAPI-Math-Kernel-Library/fastest-parallel-way-to-initialize-a-column-vector/m-p/770783#M608Gennady_F_Intel2012-04-19T14:04:43Z