主权项 |
1. A computer program product for thread binding, the computer program product comprising:
a non-transitory tangible storage medium readable by a processing circuit of a computer system and storing instructions for execution by the processing circuit for performing a method comprising: before starting execution of an application, generating a thread layout for the application, wherein generating the thread layout for the application before starting execution of the application comprises:
determining a task count comprising a number of tasks required to execute the application, wherein a plurality of tasks is required to execute the application, and the task count corresponds to the number of the plurality of tasks;determining a task rank for each task of the plurality of tasks;determining a thread count for each task of the plurality of tasks, each thread count comprising a number of threads required to execute the thread count's respective task, wherein a thread count for a first task of the plurality of tasks is unequal to a thread count of a second task of the plurality of tasks; andindicating one or more preferred processors of a plurality of processors in the computer system for each task of the plurality of tasks, wherein a first task of the plurality of tasks requires a plurality of threads to execute, wherein a first processor is indicated as a preferred processor for a first thread of the plurality of threads required to execute the first task of the plurality of tasks, and wherein a second processor that is distinct from the first processor is indicated as a preferred processor for a second thread of the plurality of threads required to execute the first task; allocating system resources, the system resources comprising the plurality of processors, for each of the tasks of the plurality of tasks based on the generated thread layout by affinitizing the tasks of the plurality of tasks, the affinitizing comprising generating threads for each of the tasks of the plurality of tasks, wherein a number of threads generated for each task of the plurality of tasks corresponds to the thread count for the task in the thread layout, and wherein each of the threads is assigned to a processor of the one or more respective preferred processors that are specified for the thread's task in the generated thread layout, wherein the first thread of the plurality of threads required to execute the first task is assigned to the first processor, and the second thread of the plurality of threads required to execute the first task is assigned to the second processor that is distinct from the first processor; and executing each of the tasks required to execute the application by the generated threads in parallel using the plurality of processors, wherein the first thread of the plurality of threads required to execute the first task is executed on the first processor, and the second thread of the plurality of threads required to execute the first task is executed on the second processor that is distinct from the first processor, wherein the first processor is not indicated as a preferred processor for the second thread of the plurality of threads required to execute the first task of the plurality of tasks, and wherein the second processor that is distinct from the first processor is not indicated as a preferred processor for the first thread of the plurality of threads required to execute the first task. |