创建cuda上下文管理器失败

时间:2013-01-21 18:57:15

标签: cuda gpu-programming physx

我正在使用PhysiX实现流体模拟器。不幸的是,cuda上下文管理器是错的,我在识别它是什么时遇到了问题。我有一个init方法,如下所示:

void InitializePhysX() {
    bool recordMemoryAllocations = true;
    const bool useCustomTrackingAllocator = true;

    PxAllocatorCallback* allocator = &gDefaultAllocatorCallback;
    PxErrorCallback* error = &gDefaultErrorCallback;
    PxFoundation* mFoundation = PxCreateFoundation(PX_PHYSICS_VERSION, *allocator, *error);
    if(!mFoundation)
            printf("PxCreateFoundation failed!\n");
    PxProfileZoneManager* mProfileZoneManager = &PxProfileZoneManager::createProfileZoneManager(mFoundation);
    if(!mProfileZoneManager)
            printf("PxProfileZoneManager::createProfileZoneManager failed!\n");
#ifdef PX_WINDOWS
    pxtask::CudaContextManagerDesc cudaContextManagerDesc;
    pxtask::CudaContextManager* mCudaContextManager = pxtask::createCudaContextManager(*mFoundation, cudaContextManagerDesc, mProfileZoneManager);
    if( mCudaContextManager ){
            if( !mCudaContextManager->contextIsValid() ){
                    mCudaContextManager->release();
                    mCudaContextManager = NULL;
                    printf("invalid context\n");
            }
    } else {
            printf("create cuda context manager failed\n");
    }
#endif
    mPhysX = PxCreatePhysics(PX_PHYSICS_VERSION, *mFoundation, PxTolerancesScale(), recordMemoryAllocations, mProfileZoneManager);
    if(!mPhysX)
            printf("PxCreatePhysics failed!\n");
    ...
}

当我尝试运行我的应用程序时,发生 mCudaContextManger 从未正确创建。 “创建cuda上下文管理器失败”正在控制台上写下:

“.... \ LowLevel \ software \ src \ PxsContext.cpp(1122):警告:GPU操作失败。没有px :: CudaContextManager可用。 .... \ SimulationController \ src \ particles \ ScParticleSystemSim.cpp(73):警告:GPU粒子系统创建失败。回到CPU实现。“

我有最新驱动程序的GeForce560Ti(错误也出现在我朋友的笔记本电脑上的GeForce460上)。 Physix设置为在NVidia控制面板中使用GPU。

有人知道我们做错了什么以及如何使GPU工作?提前谢谢!

1 个答案:

答案 0 :(得分:0)

文件PhysX3Gpu_x86.dll缺失。我添加了它,现在一切都很好。

相关问题