|
|
|
|
@ -2829,19 +2829,46 @@ int SigGroupBuild (DetectEngineCtx *de_ctx) {
|
|
|
|
|
SigAddressPrepareStage2(de_ctx);
|
|
|
|
|
|
|
|
|
|
#ifdef __SC_CUDA_SUPPORT__
|
|
|
|
|
unsigned int cuda_total = 0;
|
|
|
|
|
unsigned int cuda_free_before_alloc = 0;
|
|
|
|
|
/* we register a module that would require cuda handler service. This
|
|
|
|
|
* module would hold the context for all the patterns in the rules */
|
|
|
|
|
de_ctx->cuda_rc_mod_handle = SCCudaHlRegisterModule("SC_RULES_CONTENT_B2G_CUDA");
|
|
|
|
|
if (de_ctx->mpm_matcher == MPM_B2G_CUDA) {
|
|
|
|
|
CUcontext dummy_context;
|
|
|
|
|
if (SCCudaHlGetCudaContext(&dummy_context,
|
|
|
|
|
de_ctx->cuda_rc_mod_handle) == -1) {
|
|
|
|
|
SCLogError(SC_ERR_B2G_CUDA_ERROR, "Error getting a cuda context for the "
|
|
|
|
|
"module SC_RULES_CONTENT_B2G_CUDA");
|
|
|
|
|
}
|
|
|
|
|
if (SCCudaMemGetInfo(&cuda_free_before_alloc, &cuda_total) == 0) {
|
|
|
|
|
SCLogInfo("Total Memory available in the CUDA context used for mpm "
|
|
|
|
|
"with b2g: %.2f MB", cuda_total/(1024.0 * 1024.0));
|
|
|
|
|
SCLogInfo("Free Memory available in the CUDA context used for b2g "
|
|
|
|
|
"mpm before any allocation is made on the GPU for the "
|
|
|
|
|
"context: %.2f MB", cuda_free_before_alloc/(1024.0 * 1024.0));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
SigAddressPrepareStage3(de_ctx);
|
|
|
|
|
|
|
|
|
|
#ifdef __SC_CUDA_SUPPORT__
|
|
|
|
|
unsigned int cuda_free_after_alloc = 0;
|
|
|
|
|
/* if a user has selected some other mpm algo other than b2g_cuda, inspite of
|
|
|
|
|
* enabling cuda support, then no cuda contexts or cuda vars would be created.
|
|
|
|
|
* Pop the cuda context, only on confirming that the MPM algo selected is the
|
|
|
|
|
* CUDA mpm algo */
|
|
|
|
|
if (de_ctx->mpm_matcher == MPM_B2G_CUDA) {
|
|
|
|
|
if (SCCudaMemGetInfo(&cuda_free_after_alloc, &cuda_total) == 0) {
|
|
|
|
|
SCLogInfo("Free Memory available in the CUDA context used for b2g mpm "
|
|
|
|
|
"after allocation is made on the GPU for the context: %.2f MB",
|
|
|
|
|
cuda_free_after_alloc/(1024.0 * 1024.0));
|
|
|
|
|
SCLogInfo("Total memory consumed by the CUDA context for the b2g mpm: "
|
|
|
|
|
"%.2f MB", (cuda_free_before_alloc/(1024.0 * 1024.0)) -
|
|
|
|
|
(cuda_free_after_alloc/(1024.0 * 1024.0)));
|
|
|
|
|
}
|
|
|
|
|
/* the AddressPrepareStage3 actually handles the creation of device
|
|
|
|
|
* pointers on the gpu. The cuda context that stage3 used would still be
|
|
|
|
|
* attached to this host thread. We need to pop this cuda context so that
|
|
|
|
|
|