% Get the label element. In this file, each % listitem contains only one label. thisList = thisListitem.getElementsByTagName('label'); thisElement = thisList.item(0); % Check whether this is the label you want. % The text is in the first child node. if strcmp(thisElement.getFirstChild.getData, findLabel) thisList = thisListitem.getElementsByTagName('callback'); thisElement = thisList.item(0); findCbk = char(thisElement.getFirstChild.getData); break; end
end
if ~isempty(findCbk) msg = sprintf('Item "%s" has a callback of "%s."',... findLabel, findCbk); else msg = sprintf('Did not find the "%s" item.', findLabel); end disp(msg);
# # Each directory to which Apache has access can be configured with respect # to which services and features are allowed and/or disabled in that # directory (and its subdirectories). # # First, we configure the "default" to be a very restrictive set of # features. # <Directory /> Options FollowSymLinks AllowOverride All </Directory>
...
# # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.2/mod/core.html#options # for more information. # Options Indexes FollowSymLinks
# # AllowOverride controls what directives may be placed in .htaccess files. # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # Options FileInfo AuthConfig Limit # AllowOverride All
建站的过程其实很简单,因为AWS的Documention上已经把步骤都写好了。概要地说,就是使用AWS EC2建立一台虚拟机,进行安全和账户控制,然后在这个虚拟机上安装各式各样的东西~怎样建立一个虚拟机的Instance,怎样通过远程终端连接上去,怎样配置Apache+PHP+MySQL,其实我不是Linux的专家,但是Amazon EC2 User Guide上面都说得一清二楚。别看文档有600页,其实建立个人博客只要前几页就够了。
__global__ voidreduce0(int *g_idata, int *g_odata){ extern __shared__ int sdata[];
// each thread loads one element from global to shared mem unsignedint tid = threadIdx.x; unsignedint i = blockIdx.x*blockDim.x + threadIdx.x; sdata[tid] = g_idata[i]; __syncthreads();
// do reduction in shared mem for(unsignedint s=1; s < blockDim.x; s *= 2) { if (tid % (2*s) == 0) { sdata[tid] += sdata[tid + s]; } __syncthreads(); }
// write result for this block to global mem if (tid == 0) g_odata[blockIdx.x] = sdata[0]; }
for (unsignedint s=1; s < blockDim.x; s *= 2) { int index = 2 * s * tid; if (index < blockDim.x) { sdata[index] += sdata[index + s]; } __syncthreads(); }
for (unsignedint s=blockDim.x/2; s>0; s>>=1) { if (tid < s) { sdata[tid] += sdata[tid + s]; } __syncthreads(); }
Sequential addressing中,红字凸显的部分说明有一半的线程在第一循环迭代的时候就处于空闲状态。为了改进,我们采用first add during load技术。简单地说,我们采用上述过程一半的block,在刚进入线程的时候就进行一次operation,具体实现如下:
1 2 3 4 5 6
// perform first level of reduction, // reading from global memory, writing to shared memory unsignedint tid = threadIdx.x; unsignedint i = blockIdx.x*(blockDim.x*2) + threadIdx.x; sdata[tid] = g_idata[i] + g_idata[i+blockDim.x]; __syncthreads();