In accounting, a spreadsheet is a large sheet of paper with columns and rows that organizes data regarding transactions for a person to examine. The spreadsheet shows, for example, costs, income, taxes, or other related data on a single sheet for a manager to examine when making a decision.
Spreadsheets have been computerized into “electronic spreadsheets.” An electronic spreadsheet organizes information into software defined columns and rows. The information in the electronic spreadsheet, for example, can then be “added up” by a formula to give a total. A computer program running the electronic spreadsheet summarizes information from many sources in one place and presents the information in a given format. The electronic spreadsheet helps a decision maker see the financial “big picture” for an organization.
This Summary is provided to introduce a selection of concepts in a simplified form that are further described below in the Detailed Description. This Summary is not intended to identify key features or essential features of the claimed subject matter. Nor is this Summary intended to be used to limit the claimed subject matter's scope.
A multi-threaded codeless user-defined function (UDF) may be provided. First, at least one input value may be received from a calculation thread corresponding to a spreadsheet calling the codeless UDF. Then, the at least one input value may be saved in a thread storage area outside of a UDF storage area containing the codeless UDF. Next, the codeless UDF may be performed comprising performing at least one calculation using at least one formula in the codeless UDF and the at least one input value from the thread storage area. At least one output value produced in response to performing the codeless UDF may then be returned to the calculation thread corresponding to the spreadsheet calling the codeless UDF.
Both the foregoing general description and the following detailed description provide examples and are explanatory only. Accordingly, the foregoing general description and the following detailed description should not be considered to be restrictive. Further, features or variations may be provided in addition to those set forth herein. For example, embodiments may be directed to various feature combinations and sub-combinations described in the detailed description.
The accompanying drawings, which are incorporated in and constitute a part of this disclosure, illustrate various embodiments of the present invention. In the drawings:
The following detailed description refers to the accompanying drawings. Wherever possible, the same reference numbers are used in the drawings and the following description to refer to the same or similar elements. While embodiments of the invention may be described, modifications, adaptations, and other implementations are possible. For example, substitutions, additions, or modifications may be made to the elements illustrated in the drawings, and the methods described herein may be modified by substituting, reordering, or adding stages to the disclosed methods. Accordingly, the following detailed description does not limit the invention. Instead, the proper scope of the invention is defined by the appended claims.
Multi-threaded calculation, consistent with embodiments of the invention, may comprise a feature wherein computing work that performs a spreadsheet's calculations is divided among multiple processors (e.g. multi-processors 110). This division may allow each processor (e.g. a first processor 115, a second processor 120, and a third processor 125) to perform some computing work portion. By dividing the computing work among multi-processors 110, spreadsheet 105 may be calculated in less time than with a single processor. Furthermore, multi-threaded calculation may place restrictions on any functionality that may be performed during the spreadsheet calculation. For example, a multi-threaded calculation may be “thread-safe.” A thread-safe multi-threaded calculation may not interfere with other processors in the multiple processors performing same or different tasks. Consistent with embodiments of the invention, codeless UDFs may function when running during multi-threaded calculations. Moreover, embodiments of the invention may include additional elements including an ARGUMENT function and vectorization support as described in more detail below.
From stage 410, where computing device 900 receives the at least one input value, method 400 may advance to stage 420 where computing device 900 may save the at least one input value in a thread storage area outside of a UDF storage area containing the codeless UDF. For example, because it may not be desirable to overwrite the actual values already in the codeless UDF's input cells, instead of placing the input values directly in the codeless UDF's input cells (e.g. the UDF storage area), embodiments of the invention may instead store these input values in a separate location (e.g. the thread storage area) where spreadsheet application 920 may know to look for them when they are needed. Further, because the codeless UDF may be executed several times at once with different inputs on separate threads during multi-threaded calculation, there may be multiple storage locations for these inputs, for example, one per calculation thread. When spreadsheet application 920 needs to look up the value of an input cell, spreadsheet application 920 may be able to determine from which storage location to take the value.
Once computing device 900 saves the at least one input value in stage 420, method 400 may continue to stage 430 where computing device 900 may perform the codeless UDF comprising performing at least one calculation using at least one formula in the codeless UDF and the at least one input value from the thread storage area. For example, in order to calculate all formulas in the codeless UDF area that depend, directly or indirectly, on the input cells as referenced above, spreadsheet application 920 may need to know which formulas to calculate.
As shown in
Moreover, the formulas in FIG. 5's codeless UDF may be evaluated in a certain order. For example, B4 and B5 may be evaluated before B7, which may be evaluated before B8. In certain circumstances (not in this example), the order that formulas may be evaluated may depend on the input values. For example, if two calculation threads are evaluating the same codeless UDF with different input values, it may be possible that they may need to evaluate the formulas in different orders. Therefore, the order in which the formulas may be evaluated is information that may be stored in a data structure owned by the thread that is evaluating the UDF call. This may be called a per-call data structure.
When formula evaluation calls for retrieving a value from a cell, a process may be used to know whether or not that cell is an input cell for or contains a formula that participates in the UDF, and if so, to know which input cell or which formula it is in relation to the UDF. For example, in the normal curve example as described above with respect to
After computing device 900 performs the codeless UDF in stage 430, method 400 may proceed to stage 440 where computing device 900 may return at least one output value produced in response to performing the codeless UDF to the calculation thread corresponding to the spreadsheet calling the codeless UDF. For example, spreadsheet application 920 may take a value from an output cell of the codeless UDF and return the output cell value to the caller of the codeless UDF. As a result, codeless UDF evaluation may be thread-safe because all data that may change during the UDF's evaluation may be stored in an instance of the per-call data structure that may be owned by the thread evaluating the UDF. No other thread may look at that data structure instance. If multiple threads are evaluating the same codeless UDF simultaneously, then each thread may have its own instance of the per-call data structure. Accordingly, none of the threads may interfere with any other thread. Furthermore, if there is another thread that is not evaluating the codeless UDF but needs to retrieve the value from a cell that participates in a codeless UDF, it may be able to retrieve the value directly from the cell. Again, the threads that are evaluating the codeless UDF may not interfere with threads that are not evaluating the UDF. Once computing device 900 returns the at least one output value in stage 440, method 400 may then end at stage 450.
Consistent with embodiments of the invention, in addition to using the specified input cells, codeless UDFs may have another way to retrieve arguments that were passed to a particular call to the UDF, an “ARGUMENT” function. For example, calling ARGUMENT(n) may retrieve the nth argument to the UDF call. This may be useful because it may return arrays or cell references. Consequently, if only input cells are used to pass arguments, there may be no way to pass an array or cell reference to the UDF.
For example, a user may want to create a codeless UDF called “AREASIZE” that may take an area reference and return the count of cells in that area. Without the ARGUMENT function, it may not be impossible to create such a UDF. With the ARGUMENT function, the AREASIZE UDF may be created, for example, using the following formula:
=ROWS(ARGUMENT(1))*COLUMNS(ARGUMENT(1))
Consistent with embodiments of the invention vectorization may be provided. Vectorization may refer to the applying an operation individually to each member of an array. For example, consider the following array-entered formula:
{=SUM(SIN(A1:A10))}
Spreadsheet application 920 may perform a “SIN” function on each entry in the area A1:A10 and create an array that contains all of the results of these SIN functions. That array may then be passed to a “SUM” function that may aggregate the array and return a single value. Consequently, spreadsheet application 920 may perform vectorization if it knows that the operation in question is not intended to work on an array of values. For example, consider the following array-entered formula:
{=SUM(A1:A10)}
Spreadsheet application 920 may not call the SUM function once for each value in the range A1:A10, because spreadsheet application 920 may know that the SUM function may take arrays as arguments. Consequently, spreadsheet application 920 may only call the SUM function once and pass the entire array as an argument.
In order for codeless UDFs to take advantage of vectorization, there may be a way for the user creating the UDF to specify whether an argument can take arrays and area references or only individual values. For example, a codeless UDF that implements the hyperbolic SIN function (SINH) may specify that it takes only individual values, and therefore gets spreadsheet application 920's vectorization behavior. A codeless UDF that performs some kind of aggregation may specify that it takes arrays and area references, and therefore may not get spreadsheet application 920's vectorization behavior. Consistent with embodiments of the invnetion, codeless UDF may, upon UDF creation, allow the user to specify for each argument whether the argument can take arrays and area references or only individual values.
An embodiment consistent with the invention may comprise a system for providing a codeless user-defined function (UDF). The system may comprise a memory storage and a processing unit coupled to the memory storage. The processing unit may be operative to receive at least one input value from a calculation thread corresponding to a spreadsheet calling the codeless UDF. In addition, the processing unit may be operative to save the at least one input value in a thread storage area outside of a UDF storage area containing the codeless UDF. Moreover, the processing unit may be operative to perform the codeless UDF comprising performing at least one calculation using at least one formula in the codeless UDF and the at least one input value from the thread storage area. Also, the processing unit may be operative to return at least one output value produced in response to performing the codeless UDF to the calculation thread corresponding to the spreadsheet calling the codeless UDF.
Another embodiment consistent with the invention may comprise a system for providing a codeless user-defined function (UDF). The system may comprise a memory storage and a processing unit coupled to the memory storage. The processing unit may be operative to receive a plurality of input values respectively from a plurality of calculation threads corresponding to a spreadsheet calling the codeless UDF. Also, the processing unit may be operative to save the plurality of input values respectively in a plurality of thread storage areas. Each of the plurality of thread storage areas may be outside of a UDF storage area containing the codeless UDF. For each one of the plurality of input values, the processing unit may be operative to: i) retrieving an input value from the saved plurality of input values, ii) perform the codeless UDF comprising performing calculations using a plurality of formulas in the codeless UDF and the retrieved input value, and iii) return at least one output value produced in response to performing the codeless UDF to the calculation thread corresponding to the retrieved input value.
Yet another embodiment consistent with the invention may comprise a system for providing a codeless user-defined function (UDF). The system may comprise a memory storage and a processing unit coupled to the memory storage. The processing unit may be operative to save at least one input value in a thread storage area outside of a UDF storage area containing the codeless UDF. The at least one input value may correspond a calculation thread corresponding to a spreadsheet calling the codeless UDF. In addition, the processing unit may be operative to perform the codeless UDF comprising the processing unit being operative to perform at least one calculation using at least one formula in the codeless UDF and the at least one input value from the thread storage area. The processing unit being operative to perform the at least one calculation using the at least one formula may comprise the processing unit being operative to perform the at least one calculation using the at least one formula in response to the processing unit determining that the at least one formula is identified in a per-UDF data structure. The per-UDF data structure may identify formulas in the codeless UDF that have at least one of the following characteristics: depend directly on at least one input cell in the codeless UDF, depend indirectly on at least one input cell in the codeless UDF, is volatile, and depend on other volatile formula in the codeless UDF. The processing unit being operative to perform the codeless UDF may comprise the processing unit being operative to perform the codeless UDF in an order defined by a per-call data structure. Moreover, the processing unit may be operative to return at least one output value produced in response to the processing unit performing the codeless UDF to the calculation thread corresponding to the spreadsheet calling the codeless UDF.
With reference to
Computing device 900 may have additional features or functionality. For example, computing device 900 may also include additional data storage devices (removable and/or non-removable) such as, for example, magnetic disks, optical disks, or tape. Such additional storage is illustrated in
Computing device 900 may also contain a communication connection 916 that may allow device 900 to communicate with other computing devices 918, such as over a network in a distributed computing environment, for example, an intranet or the Internet. Communication connection 916 is one example of communication media. Communication media may typically be embodied by computer readable instructions, data structures, program modules, or other data in a modulated data signal, such as a carrier wave or other transport mechanism, and includes any information delivery media. The term “modulated data signal” may describe a signal that has one or more characteristics set or changed in such a manner as to encode information in the signal. By way of example, and not limitation, communication media may include wired media such as a wired network or direct-wired connection, and wireless media such as acoustic, radio frequency (RF), infrared, and other wireless media. The term computer readable media as used herein may include both storage media and communication media.
As stated above, a number of program modules and data files may be stored in system memory 904, including operating system 905. While executing on processing unit 902, programming modules 906 (e.g. electronic spreadsheet application 920) may perform processes including, for example, one or more method 400's stages as described above. The aforementioned process is an example, and processing unit 902 may perform other processes. Other programming modules that may be used in accordance with embodiments of the present invention may include electronic mail and contacts applications, word processing applications, spreadsheet applications, database applications, slide presentation applications, drawing or computer-aided application programs, etc.
Generally, consistent with embodiments of the invention, program modules may include routines, programs, components, data structures, and other types of structures that may perform particular tasks or that may implement particular abstract data types. Moreover, embodiments of the invention may be practiced with other computer system configurations, including hand-held devices, multiprocessor systems, microprocessor-based or programmable consumer electronics, minicomputers, mainframe computers, and the like. Embodiments of the invention may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote memory storage devices.
Furthermore, embodiments of the invention may be practiced in an electrical circuit comprising discrete electronic elements, packaged or integrated electronic chips containing logic gates, a circuit utilizing a microprocessor, or on a single chip containing electronic elements or microprocessors. Embodiments of the invention may also be practiced using other technologies capable of performing logical operations such as, for example, AND, OR, and NOT, including but not limited to mechanical, optical, fluidic, and quantum technologies. In addition, embodiments of the invention may be practiced within a general purpose computer or in any other circuits or systems.
Embodiments of the invention, for example, may be implemented as a computer process (method), a computing system, or as an article of manufacture, such as a computer program product or computer readable media. The computer program product may be a computer storage media readable by a computer system and encoding a computer program of instructions for executing a computer process. The computer program product may also be a propagated signal on a carrier readable by a computing system and encoding a computer program of instructions for executing a computer process. Accordingly, the present invention may be embodied in hardware and/or in software (including firmware, resident software, micro-code, etc.). In other words, embodiments of the present invention may take the form of a computer program product on a computer-usable or computer-readable storage medium having computer-usable or computer-readable program code embodied in the medium for use by or in connection with an instruction execution system. A computer-usable or computer-readable medium may be any medium that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device.
The computer-usable or computer-readable medium may be, for example but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, device, or propagation medium. More specific computer-readable medium examples (a non-exhaustive list), the computer-readable medium may include the following: an electrical connection having one or more wires, a portable computer diskette, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, and a portable compact disc read-only memory (CD-ROM). Note that the computer-usable or computer-readable medium could even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via, for instance, optical scanning of the paper or other medium, then compiled, interpreted, or otherwise processed in a suitable manner, if necessary, and then stored in a computer memory.
Embodiments of the present invention, for example, are described above with reference to block diagrams and/or operational illustrations of methods, systems, and computer program products according to embodiments of the invention. The functions/acts noted in the blocks may occur out of the order as shown in any flowchart. For example, two blocks shown in succession may in fact be executed substantially concurrently or the blocks may sometimes be executed in the reverse order, depending upon the functionality/acts involved.
While certain embodiments of the invention have been described, other embodiments may exist. Furthermore, although embodiments of the present invention have been described as being associated with data stored in memory and other storage mediums, data can also be stored on or read from other types of computer-readable media, such as secondary storage devices, like hard disks, floppy disks, or a CD-ROM, a carrier wave from the Internet, or other forms of RAM or ROM. Further, the disclosed methods' stages may be modified in any manner, including by reordering stages and/or inserting or deleting stages, without departing from the invention.
All rights including copyrights in the code included herein are vested in and the property of the Applicant. The Applicant retains and reserves all rights in the code included herein, and grants permission to reproduce the material only in connection with reproduction of the granted patent and for no other purpose.
While the specification includes examples, the invention's scope is indicated by the following claims. Furthermore, while the specification has been described in language specific to structural features and/or methodological acts, the claims are not limited to the features or acts described above. Rather, the specific features and acts described above are disclosed as example for embodiments of the invention.