Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • GHC GHC
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4,826
    • Issues 4,826
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 448
    • Merge requests 448
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Releases
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Glasgow Haskell Compiler
  • GHCGHC
  • Merge requests
  • !5176

Open
Created Mar 04, 2021 by Douglas Wilson@duogDeveloper
  • Report abuse
Report abuse

Draft: Add ghc flag -jsem

  • Overview 33
  • Commits 1
  • Pipelines 4
  • Changes 6

Re #19416

This patch adds a flag to ghc allowing the parallelism of --make to be controlled with a POSIX semaphore, allowing parallel invocations of ghc --make to cooperate in limiting their CPU bound threads.

Several details remain to be decided, so this remains a draft:

  • what should the flag be called? -jsem seems quite terrible
  • An implementation for windows should be provided
  • Should we instead(or as well) conform to the GNU make jobserver protocol? https://www.gnu.org/software/make/manual/html_node/Job-Slots.html
  • Clients of GNU make jobserver are expected to have 1 active job, then claim additional jobs from the jobserver. This implementation just replaces the old QSem with a posix semaphore, so a ghc may have 0 active jobs. Is this Okay?

Building lens and it's dependencies from scratch on a 12 core machine shows some improvement:

without -jsem:

	Command being timed: "cabal --store-dir /home/doug/code/ghc.jsem/lenstest/_out/store v2-build lens --offline --ghc-options=-j -j"
	User time (seconds): 522.76
	System time (seconds): 44.70
	Percent of CPU this job got: 386%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 2:26.76

with -jsem:

	Command being timed: "cabal --store-dir /home/doug/code/ghc.jsem/lenstest/_out/store v2-build lens --offline --ghc-options=-j -jsem ghc.sem -j"
	User time (seconds): 416.23
	System time (seconds): 28.51
	Percent of CPU this job got: 335%
	Elapsed (wall clock) time (h:mm:ss or m:ss): 2:12.51
Edited Jul 28, 2021 by Ben Gamari
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: wip/jsem