What an individual does to his or her body is their own choice and no one else's regardless of the reason. Of course if they participate in an activity that puts others at danger such as operating a motor vehicle then it is not okay but that was not stipulated it is irrelevant to this particular question. In conclusion it is okay to take whatever you want if it is responsibly.
It all depends on how risky the drugs are and what the potential outcome of the drug is versus the potential cognitive gain. If the drug might kill you, or increase your attention 5 percent then no, but if the side effects are potentially minimal for untapped brain power then by all means its worth the risk.
While performance on tests and work may be important, it's not worth risking your health and happiness. Taking a risky drug could lead to severe consequences such as depression or physical disability. The risks associated with certain cognitive improvement drugs far outweighs the benefits that can be gained. It's not worth putting yourself at risk for serious injury when the benefits are relatively minor.
It is not okay to use drugs to enhance cognitive functioning. Many students resort to taking Alderall in order to improve their performance. This might give them an edge in the short run, but in the long run, it leads to addiction; which becomes a strain on both a student's health and/or pocket.
Many of these drugs are very dangerous, and can shorten a person's life span and have lasting damage. There is no technological or career advancement that would make it worth it to take these drugs. If it is enough of a problem, employers should test for these drugs, or reconsider their demands on employees.