void init(const char* argv0) { rmt_CreateGlobalInstance(&rmt); PHYSFS_init(argv0); PHYSFS_mount("AppData", 0, 1); PHYSFS_mount("../AppData", 0, 1); PHYSFS_mount("../../AppData", 0, 1); if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER)<0) { fprintf(stderr, "Unable to open SDL: %s\n", SDL_GetError()); ::exit(1); } SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 24 ); SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, TRUE ); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 ); SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, 4 ); SDL_GL_SetAttribute( SDL_GL_FRAMEBUFFER_SRGB_CAPABLE, 1 ); SDL_GL_SetAttribute( SDL_GL_CONTEXT_MAJOR_VERSION, 4 ); SDL_GL_SetAttribute( SDL_GL_CONTEXT_MINOR_VERSION, 4 ); SDL_GL_SetAttribute( SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE ); #ifdef _DEBUG SDL_GL_SetAttribute( SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG ); #endif window = SDL_CreateWindow( "", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 1280, 720, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE ); if(!window) { fprintf(stderr, "Unable to create window: %s\n", SDL_GetError()); ::exit(1); } context = SDL_GL_CreateContext(window); importOpenGL(); core::init(); gfx::init(1280, 720); ui::init(1280, 720); app::init(); notifyResize(1280, 720); prevTime = timerAbsoluteTime(); runLoop = true; recompileGLPrograms = false; }
int main(int argc, const char * argv[]) { int run; uint64_t inMax_outSum, i; volatile uint64_t serialSum; Remotery* rmt; rmt_CreateGlobalInstance(&rmt); pETS = enkiNewTaskScheduler(); enkiGetProfilerCallbacks( pETS )->threadStart = threadStartCallback; enkiGetProfilerCallbacks( pETS )->waitStart = waitStartCallback; enkiGetProfilerCallbacks( pETS )->waitStop = waitStopCallback; enkiInitTaskScheduler( pETS ); rmt_SetCurrentThreadName("Main"); pPSumTask = enkiCreateTaskSet( pETS, ParallelSumTaskSetFunc ); pPSumReductionTask = enkiCreateTaskSet( pETS, ParallelReductionSumTaskSet ); for (run = 0; run < RUNS; ++run) { rmt_BeginCPUSample(Run); printf("Run %d.....\n", run); rmt_BeginCPUSample(Parallel); inMax_outSum = SUMS; enkiAddTaskSetToPipe(pETS, pPSumReductionTask, &inMax_outSum, 1); enkiWaitForTaskSet(pETS, pPSumReductionTask); rmt_EndCPUSample(); rmt_BeginCPUSample(Serial); serialSum = 0; for (i = 0; i < SUMS; ++i) { serialSum += i + 1; } rmt_EndCPUSample(); rmt_EndCPUSample(); } enkiDeleteTaskScheduler( pETS ); }
void setup() { setupAntTweakBar(); checkCudaErrors(cuInit(0)); if (sketchArgc != 2) { printf("Usage: %s <cuda_toy.cu>\n", sketchArgv[0]); quit(); return; } if (RMT_ERROR_NONE != rmt_CreateGlobalInstance(&rmt)) { //return -1; } int r = uv_fs_event_init(uv_default_loop(), &fs_event); r = uv_fs_event_start(&fs_event, on_fs_event_cb, sketchArgv[1], 0); char title[256]; sprintf(title, "CUDA ShaderToy - %s", sketchArgv[1]); glfwSetWindowTitle(window, title); setupModuleResource(sketchArgv[1]); setupSizeResource(); rmtCUDABind bind; bind.context = cuContext; bind.CtxSetCurrent = &cuCtxSetCurrent; bind.CtxGetCurrent = &cuCtxGetCurrent; bind.EventCreate = &cuEventCreate; bind.EventDestroy = &cuEventDestroy; bind.EventRecord = &cuEventRecord; bind.EventQuery = &cuEventQuery; bind.EventElapsedTime = &cuEventElapsedTime; rmt_BindCUDA(&bind); rmt_BindOpenGL(); }
int main( ) { Remotery *rmt; rmtError error; signal(SIGINT, sigintHandler); error = rmt_CreateGlobalInstance(&rmt); if( RMT_ERROR_NONE != error) { printf("Error launching Remotery %d\n", error); return -1; } while (sig == 0) { rmt_LogText("start profiling"); delay(); rmt_LogText("end profiling"); } rmt_DestroyGlobalInstance(rmt); printf("Cleaned up and quit\n"); return 0; }
int main(int _argc, char** _argv) { //DBG(BX_COMPILER_NAME " / " BX_CPU_NAME " / " BX_ARCH_NAME " / " BX_PLATFORM_NAME); if (BX_ENABLED(ENTRY_CONFIG_PROFILER) ) { rmtSettings* settings = rmt_Settings(); BX_WARN(NULL != settings, "Remotery is not enabled."); if (NULL != settings) { settings->malloc = rmtMalloc; settings->realloc = rmtRealloc; settings->free = rmtFree; rmtError err = rmt_CreateGlobalInstance(&s_rmt); BX_WARN(RMT_ERROR_NONE != err, "Remotery failed to create global instance."); if (RMT_ERROR_NONE == err) { rmt_SetCurrentThreadName("Main"); } else { s_rmt = NULL; } } } #if BX_CONFIG_CRT_FILE_READER_WRITER s_fileReader = new bx::CrtFileReader; s_fileWriter = new bx::CrtFileWriter; #endif // BX_CONFIG_CRT_FILE_READER_WRITER cmdInit(); cmdAdd("mouselock", cmdMouseLock); cmdAdd("graphics", cmdGraphics ); cmdAdd("exit", cmdExit ); inputInit(); inputAddBindings("bindings", s_bindings); entry::WindowHandle defaultWindow = { 0 }; entry::setWindowTitle(defaultWindow, bx::baseName(_argv[0]) ); setWindowSize(defaultWindow, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT); int32_t result = ::_main_(_argc, _argv); inputRemoveBindings("bindings"); inputShutdown(); cmdShutdown(); #if BX_CONFIG_CRT_FILE_READER_WRITER delete s_fileReader; s_fileReader = NULL; delete s_fileWriter; s_fileWriter = NULL; #endif // BX_CONFIG_CRT_FILE_READER_WRITER if (BX_ENABLED(ENTRY_CONFIG_PROFILER) && NULL != s_rmt) { rmt_DestroyGlobalInstance(s_rmt); } return result; }