Skip to content

Add smallpt as an example notebook #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2025

Conversation

anutosh491
Copy link
Collaborator

Description

Please include a summary of changes, motivation and context for this PR.

Replicating https://www.kevinbeason.com/smallpt/ through xeus-cpp-lite

Type of change

Please tick all options which are relevant.

  • Bug fix
  • New feature
  • Added/removed dependencies
  • Required documentation updates

@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.72%. Comparing base (ed69a4c) to head (0656b04).

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #235   +/-   ##
=======================================
  Coverage   80.72%   80.72%           
=======================================
  Files          19       19           
  Lines         970      970           
  Branches       93       93           
=======================================
  Hits          783      783           
  Misses        187      187           

@anutosh491 anutosh491 merged commit 7a0d110 into compiler-research:main Jan 23, 2025
14 checks passed
@anutosh491 anutosh491 deleted the smallpt branch January 23, 2025 12:41
anutosh491 added a commit that referenced this pull request Jan 23, 2025
anutosh491 added a commit that referenced this pull request Jan 23, 2025
@vgvassilev
Copy link
Contributor

Why was this reverted?

PUBLIC "SHELL: -s EXPORTED_RUNTIME_METHODS='[\"FS\",\"PATH\",\"LDSO\",\"loadDynamicLibrary\",\"ERRNO_CODES\"]'"
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH}/include@/include"
PUBLIC "SHELL: --preload-file ${SYSROOT_PATH}/@/"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops, I think I had messed up a tad bit here (I just realized this)

Hey @vgvassilev ,

If you remember we had attempted to add the example notebook for smallpt in our codebase. And then I had made a commit to revert this patch #236

The reason for the revert was this

  1. As you see I moved a level above sysroot/include here to just sysroot. So obviously we were preloading much more than we wanted in our file system. So our builds had this warning
warning: file packager is creating an asset bundle of 582 MB. this is very large, and browsers might have trouble loading it. see https://hacks.mozilla.org/2015/02/synchronous-execution-and-filesystem-access-in-emscripten/
  1. So though stuff was running locally pretty smoothly .... our deployment was having trouble loading the xcpp.data file which turned out to be huge as the warning said.

Hence the revert.

What I just realized is all SDL headers also lie inside the sysroot/include location (not sure if this was changed as we shifted to emscripten 3.1.73 or so)

(base) anutosh491@Anutoshs-MacBook-Air SDL % pwd
/Users/anutosh491/work/emsdk/upstream/emscripten/cache/sysroot/include/SDL
(base) anutosh491@Anutoshs-MacBook-Air SDL % ls
COPYING                 SDL_config.h            SDL_config_pandora.h    SDL_gesture.h           SDL_keycode.h           SDL_opengl.h            SDL_render.h            SDL_syswm.h             begin_code.h
SDL.h                   SDL_config.h.in         SDL_config_windows.h    SDL_gfxPrimitives.h     SDL_loadso.h            SDL_opengles.h          SDL_revision.h          SDL_thread.h            close_code.h
SDL_assert.h            SDL_config_android.h    SDL_config_wiz.h        SDL_haptic.h            SDL_log.h               SDL_opengles2.h         SDL_rotozoom.h          SDL_timer.h
SDL_atomic.h            SDL_config_emscripten.h SDL_copying.h           SDL_hints.h             SDL_main.h              SDL_pixels.h            SDL_rwops.h             SDL_touch.h
SDL_audio.h             SDL_config_iphoneos.h   SDL_cpuinfo.h           SDL_image.h             SDL_mixer.h             SDL_platform.h          SDL_scancode.h          SDL_ttf.h
SDL_blendmode.h         SDL_config_macosx.h     SDL_endian.h            SDL_input.h             SDL_mouse.h             SDL_power.h             SDL_shape.h             SDL_types.h
SDL_clipboard.h         SDL_config_minimal.h    SDL_error.h             SDL_joystick.h          SDL_mutex.h             SDL_quit.h              SDL_stdinc.h            SDL_version.h
SDL_compat.h            SDL_config_nintendods.h SDL_events.h            SDL_keyboard.h          SDL_name.h              SDL_rect.h              SDL_surface.h           SDL_video.h

Which means are already having access to the SDL header right now. We don't need to change nothing with preloading and we should definitely be able to add this example !

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants