允许在security.yml中对Symfony对象操作进行不安全的访问(Allow unsecured access to Symfony object action in security.yml)
我在Symfony 1.4.13中有一个特定的模块,默认设置在security.yml文件中。 我有一个特定的对象动作,我希望任何人都可以访问(注销用户),但似乎无法找到正确的方法来在YAML文件中找出动作的名称以获得匹配。
具体来说,我有一个
project
模块,其中包含典型的索引,显示,创建等操作,以及runReport
对象操作(因此操作方法的名称为executeListRunReport
)。 security.yml文件如下:all: is_secure: true index: credentials: pm_view show: credentials: pm_view filter: credentials: pm_view runReport: # This is the one that is giving me problems is_secure: false
actions.php中的方法是:
public function executeListRunReport(sfWebRequest $request) { ... }
当进入
project/[idOfObject]/ListRunReport
时,这适用于登录用户。如何编写security.yml文件以允许任何人访问该操作(例如直接从我手工生成的URL)而无需登录? 谢谢!
I have a particular module in Symfony 1.4.13 that is set to be secured by default in its security.yml file. I have one particular object action that I would like accessible by anyone (logged out users), but can't seem to find the correct way to right out action's name in the YAML file to get a match on it.
Specifically, I have a
project
module with the typical index, show, create, etc. actions, as well as arunReport
object action (so the action method's name isexecuteListRunReport
). The security.yml file is as follows:all: is_secure: true index: credentials: pm_view show: credentials: pm_view filter: credentials: pm_view runReport: # This is the one that is giving me problems is_secure: false
My method in actions.php is:
public function executeListRunReport(sfWebRequest $request) { ... }
This works just fine for a logged in user when going to
project/[idOfObject]/ListRunReport
.How can I write the security.yml file to allow anyone to access that action (directly from a URL that I generate by hand for example) without having to log in? Thanks!
原文:https://stackoverflow.com/questions/7810210
最满意答案
由于引入了CUBLAS V2 API(使用CUDA 4.0,IIRC),因此可以使用返回标量或索引的例程将它们直接存储到设备内存中的变量中,而不是存储到主变量中(这需要设备主机传输并可能将结果留在错误的内存空间中)。
要使用它,你需要使用
cublasSetPointerMode
调用来告诉CUBLAS上下文,期望通过使用CUBLAS_POINTER_MODE_DEVICE
模式,标量参数的指针成为设备指针。 这就意味着在这样的通话中cublasStatus_t cublasIsamax(cublasHandle_t handle, int n, const float *x, int incx, int *result)
该
result
必须是设备指针。Since the CUBLAS V2 API was introduced (with CUDA 4.0, IIRC), it is possible to have routines which return a scalar or index to store those directly into a variable in device memory, rather than into a host variable (which entails a device to host transfer and might leave the result in the wrong memory space).
To use this, you need to use the
cublasSetPointerMode
call to tell the CUBLAS context to expect pointers for scalar arguments to be device pointers by using theCUBLAS_POINTER_MODE_DEVICE
mode. This then implies that in a call likecublasStatus_t cublasIsamax(cublasHandle_t handle, int n, const float *x, int incx, int *result)
that
result
must be a device pointer.
相关问答
更多-
如果OpenCV的Cuda扩展不可用,请使用CPU回退(Use CPU fallback if OpenCV's Cuda extensions are not available)[2022-09-14]
如果要实现回退,则可能需要在运行时切换到它。 但是您收到编译器错误消息的事实表明您正在使用不同的标志进行编译。 一般来说,你可能想要这样的东西: if (HasCuda()) { RunCudaCode(...); } else { RunCpuCode(...); } 或者,您可以构建两个共享库,一个和一个没有Cuda,并根据HasCuda()加载您需要的HasCuda() 。 但是,如果您的二进制文件非常庞大并且遇到了内存问题,那么这种方法才有意义。 可能需要在初始化Cuda的启动代码中使用类 ... -
CUDA中的整数最小值/最大值(Integer min/max in CUDA)[2023-01-22]
有整数的最小/最大设备函数,但它们都被重载的max()调用。 查看device_functions.hpp: __DEVICE_FUNCTIONS_STATIC_DECL__ int max(int x, int y) { return __nv_max(x, y); } __DEVICE_FUNCTIONS_STATIC_DECL__ unsigned int umax(unsigned int x, unsigned int y) { return __nv_umax(x, y); } __ ... -
编译器需要M作为编译时常量。 在编译时它无法确定M实际上是什么(它不知道你最终会将它传递给84)。 如果要使用只在运行时知道的大小共享内存,则使用动态共享内存。 请参阅站点上的此示例或在Parallel4All博客上使用CUDA中的共享内存 。 The compiler needs M to be a compile-time constant. At compile time it cannot determine what M is actually going to be (it doesn't kn ...
-
这里有几个问题。 您需要修改warp和block最小函数,以便在每次找到新的局部最小值时传播最小值及其索引。 也许是这样的: __inline__ __device__ void warpReduceMin(int& val, int& idx) { for (int offset = warpSize / 2; offset > 0; offset /= 2) { int tmpVal = __shfl_down(val, offset); int tmpIdx = ...
-
为什么我的CUDA实现与我的CPU实现同样快(Why is my CUDA implementation equally fast as my CPU implementation)[2023-11-19]
kernelkernel<<>> 这是一个重要的问题; nVidia GPU上的线程以32个线程的变形工作。 但是,您只为每个块分配了单个线程,这意味着这些线程中的31个将在单个线程工作时处于空闲状态。 通常情况下,对于具有灵活性的内核,通常每块需要多个warp,而不仅仅是一个warp。 您可以通过每个块使用N个块和N个线程立即加速,而不是使用N ^ 2个块。 实际上,N可能太大,因为每块的线程数有上限。 虽然可以选择合适的M,以便每块使用N / M个线程,并使用N * M个块。 实际上 ... -
这不是使用动态分配的共享内存的有效方法: T *sdata = SharedMemory
(); int *sdataIdx = SharedMemory (); 这两个指针( sdata和sdataIdx )最终将指向同一位置。 ( 文档讨论了如何正确处理这个问题。) 即使您现在想要使用两倍的共享内存(用于存储min plus index),与之前的仅减少代码相比,您还没有增加动态分配大小: int smemSize = (threads <= 32) ? 2 * thre ... -
由于引入了CUBLAS V2 API(使用CUDA 4.0,IIRC),因此可以使用返回标量或索引的例程将它们直接存储到设备内存中的变量中,而不是存储到主变量中(这需要设备主机传输并可能将结果留在错误的内存空间中)。 要使用它,你需要使用cublasSetPointerMode调用来告诉CUBLAS上下文,期望通过使用CUBLAS_POINTER_MODE_DEVICE模式,标量参数的指针成为设备指针。 这就意味着在这样的通话中 cublasStatus_t cublasIsamax(cublasHandl ...
-
您只需添加__host__关键字即可从主机或设备调用函数调用。 __host__ __device__ int sum(int a, int b){ return a+b; } You just have to add the __host__ keyword to be able to call call a function from host or device. __host__ __device__ int sum(int a, int b){ return a+b; }
-
CUDA处理图像(CUDA processing image)[2023-08-12]
人们是对的,但我会告诉你继续做下去。 在图像上执行此类操作对于理解CUDA和并行编程是完美的,尽管作为多线程CPU不是很有效。 我的建议使用1-使用单个线程来执行操作并为每个操作计时。 2-然后使用OpenMP在CPU上执行操作(使用2,4和更多线程,具体取决于您拥有的核心数量.3)尝试在Cuda中编程,您将学习很多并行编程基元。过程(并行减少最小值,平均操作) 稍后当你想要更复杂的东西,如直方图,可变形注册或平滑操作时,你将开始欣赏并行编程速度。 提示:读取图像等IO操作在所有程序中都具有相同的代码。 P ... -
如果同时从多个pthreads调用CUDA内核会发生什么?(What happen if a CUDA kernel is called from multiple pthreads simultaneously?)[2022-02-09]
内核调用在单个流中排队并逐个执行。 但是,您可以在内核执行期间指定流 - 然后可以同时运行不同流中的CUDA操作,并且可以交错来自不同流的操作。 默认流为0。 请参阅: CUDA Streams和Concurrency 当不同的进程使用相同的卡时,情况类似。 还记得内核是从CPU的东西异步执行的。 Kernel calls are queued and executed one by one in single stream. However you can specify stream during ke ...